Wavelet Coherence

1 min read

Wavelet transform coherence (WTC) is a method for analyzing the coherence and phase lag between two time series as a function of both time and frequency (Chang and Glover 2010). Here I played with it using the MatLab toolbox provided by Grinsted et al.

In the following examples, I created two time series, x (blue) and y (red) with different properties (phase shift, frequency and amplitude) and run wtc(x,y,’mcc’,0) command. Small white noise was added to the time series.

1. Phase shift and angle. A rightward arrow indicates 0 lag; a bottom-right arrow indicates a small lead of x; a leftward arrow indicates x and y is anti-correlated.

Phase
Phase

2. Frequency. At what frequency (or period) are x and y correlated?

frequency
frequency

3. Amplitude. It seems amplitude doesn’t matter much.

amplitude
amplitude

Toolbox can be found:
http://www.pol.ac.uk/home/research/waveletcoherence/
Note: this link is dead. To download the “Cross Wavelet and Wavelet Coherence Toolbox”, please enter
https://www.alivelearn.net/?p=1561

MatLab source code:

t =[1:1000]/10;

%% effect of phase
x = sin(t) + randn(size(t))/5;
y = [sin(t(1:250)) sin(t(251:500)-pi/4) sin(t(501:750)-pi/2) sin(t(751:end)-pi)] + randn(size(t))/5;

figure('color','w');
subplot(2,1,1);
wtc(x,y,'mcc',0)
subplot(2,1,2);
plot(x);
hold on;
plot(y,'r')

%% effect of frequency
x = [sin(2*t(1:250)) sin(2*t(251:500)) sin(4*t(501:750)) sin(8*t(751:end))] + randn(size(t))/5;
y = [sin(2*t(1:250)) sin(2*t(251:500)) sin(4*t(501:750)) sin(8*t(751:end))] + randn(size(t))/5;

figure('color','w');
subplot(2,1,1);
wtc(x,y,'mcc',0)
subplot(2,1,2);
plot(x);
hold on;
plot(y,'r')

%% effect of amplitude
x = [sin(2*t(1:250)) sin(2*t(251:500)) sin(4*t(501:750)) sin(8*t(751:end))] + randn(size(t))/5;
y = [sin(2*t(1:250)) sin(2*t(251:500))/2 sin(4*t(501:750))/3 sin(8*t(751:end))/4] + randn(size(t))/5;

figure('color','w');
subplot(2,1,1);
wtc(x,y,'mcc',0)
subplot(2,1,2);
plot(x);
hold on;
plot(y,'r')



写作助手,把中式英语变成专业英文


Want to receive new post notification? 有新文章通知我

第五十七期fNIRS Journal Club通知2024/11/02, 10am 王欣悦博士

肢体语言——例如人际距离、眼神、手势等,如何影响我们的交流,是一个有趣的谜题。它们是优雅而神秘的代码,无本可依、无人知晓,却又无人不懂。来自南京师范大学的王欣悦博士将分享如何通过fNIRS超扫描技术,
Wanling Zhu
16 sec read

第五十六期fNIRS Journal Club视频 李开云副教授

Youtube: https://youtu.be/bKanFfeV5Ao 优酷:https://v.youku.com/v_show/id_XNjQzNDUzMjU4OA==.html 孤独症谱系障
Wanling Zhu
27 sec read

第五十六期fNIRS Journal Club通知2024/09/28, 10am 李开云副教授

孤独症谱系障碍(Autism Spectrum Disorder, ASD)是一种复杂的神经发育障碍,其核心特征包括社交沟通障碍、重复刻板行为和限制性兴趣。济南大学教育与心理科学学院李开云博士借助fN
Wanling Zhu
21 sec read

18 Replies to “Wavelet Coherence”

  1. Respected Sir,
    I need an help from you.I have a doubt in wavelet coherence using matlab.i have two series of length 80.how should i write the code in matlab so that i will get the wavelet coherence of two time series is a single value?

  2. The ‘v6’ argument to COLORBAR is
    deprecated, and will no longer be supported in a
    future release.

  3. How to compute cross wavelet or wavelet coherence for time series having same sampling rate but different lengths?

  4. Respect Sir. I have some questions below and look forward to receive your answer:
    1. [rsv,period] = wtc(x,y,’mcc’,0); In my experiment, x,y have a length of 90 seconds(sampling rate equals to 12). But the minimum frequency of 1/(period/sampling rate) I calculate is around 0.03Hz, instead of 1/90 Hz. Is the result wrong? Does this mean if i want to reach the minimum of 0.01Hz, I need a longer data(more than 90 seconds)?
    2. [rsv,period] = wtc(x,y,’mcc’,0); The frequency sequence i got based on 1/(period/sampling rate) is not distributed uniformly. It’s not convenient to segment frequency range for further analysis. How to solve this problem?

  5. I have a question. What is the meaning of axis y (period)? I don’t understand, why chose 4-128? Can you explain a little bit about this?

Leave a Reply

Your email address will not be published. Required fields are marked *