File Exchange

image thumbnail

Cross wavelet and wavelet coherence

version 1.0.0.0 (1.32 MB) by Aslak Grinsted
A cross wavelet and wavelet coherence toolbox

37 Downloads

Updated 11 Nov 2017

GitHub view license on GitHub

This is toolbox makes it very easy to do wavelet coherence analysis:
The thumbnail image was generated by calling:

d1=load('jao.txt');
d2=load('jbaltic.txt');
wtc(d1,d2)

---
wt: continuous wavelet plot
xwt: cross wavelet plot
wtc: wavelet coherence plot

Website: http://www.glaciology.net/wavelet-coherence

Cite As

Aslak Grinsted (2019). Cross wavelet and wavelet coherence (https://www.github.com/grinsted/wavelet-coherence), GitHub. Retrieved .

Comments and Ratings (18)

zhaochen Li

Rogers365

How to change period/scale?

I use Matlab r2018a and it comes with a function "wcoherence" that returns the magnitude-squared wavelet coherence between two equal length signals. Is the function "wtc" of this toolbox differ from that function? If yes, then how?

FRFQQW

How to change the scale?
Thanks

it used to work perfectly, but now I get the following error:
Error using wtc (line 116)
Automatic AR1 estimation failed. Specify it manually (use arcov or arburg).

Error in untitled (line 3)
wtc(d1,d2)

How to bring the code back to life?
thanks

Danhay

So far, an excellent tool. I have a question about the cache, I seem to get this error when running wtc:
"Warning: Unable to write to cache file:
D:\MATLAB\Code\grinsted-wavelet-coherence-d987ea4\.cache\wtcsignif-cached-gf.mat
> In wtcsignif at 156
In wtc at 163 "

Perhaps there's a problem with the permissions of the location where I've stored the toolbox? Any suggestions?

Rahul

I get the following error while running wavelet coherence b/w EEG and center-of-mass velocity during a posture task (this can take negative values)
"Subscript indices must either be real positive integers or logicals.
Error in rednoise (line 55)
yred=yred(tau+1:end);
Error in wtcsignif (line 119)
d2=rednoise(n,ar1(2),1);
Error in wtc (line 163)
wtcsig=wtcsignif(Args.MonteCarloCount,Args.AR1,dt,length(t)*2,Args.Pad,Args.Dj,Args.S0,Args.J1,Args.Mother,.6);"

On some investigation, I observed that this is generated because the Lag one covariane comes out to be greater than Lag 0 covariance in "ar1nv.m", because of which, the estimate of noise variance is a complex number instead of a real number (as g>1).

So, I was wondering if there is any way around it?

heba salah

how to install it on Matlab R2016b

Danhay

God bless you.

@student: yes you need to fill the data gaps. for example using interpolation ofr the mean value. If the gaps are much shorter than the shortest wavelength you are interested in then they wont have much effect on the output.

student

I have data every 10 minutes.
The software does not accept lack of data in some time (the software does not run with NaN).
I can replace the NaN by ZERO ?? Would you have any suggestions without having to share the data file?

Example:

34.3167 10.2950
34.3208 NaN
34.3250 8.3275
34.3292 7.9050
34.3333 6.1225
34.3375 NaN
34.3417 2.7800
34.3458 1.0475
34.3500 -0.2650
34.3542 -1.4075
34.3583 -2.5825
34.3625 -3.5925
34.3667 NaN
34.3708 NaN
34.3750 NaN
34.3792 NaN
34.3833 NaN
34.3875 NaN
34.3917 -6.7925
34.3958 -6.8100
34.4000 -6.3875
34.4042 NaN
34.4083 -5.7900
34.4125 -5.5300
34.4167 -5.4625
34.4208 -5.6075
34.4250 -5.7350
34.4292 -5.8350
34.4333 NaN
34.4375 -5.8050
34.4417 -5.7425
34.4458 -5.2750
34.4500 -3.9725
34.4542 NaN

Thanks in advance

useful for any discipline

Greg

Great job, thank you!

junjun shi

nice

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux