File Exchange

image thumbnail

Cross wavelet and wavelet coherence

version (878 KB) by Aslak Grinsted
A cross wavelet and wavelet coherence toolbox


Updated 11 Nov 2017

From GitHub

View license on GitHub

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


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


Cite As

Aslak Grinsted (2021). Cross wavelet and wavelet coherence (, GitHub. Retrieved .

Comments and Ratings (25)

Ali Awais

Madan Kumar

while working on it, it shows Automatic AR1 estimation failed. Specify it manually (use arcov or arburg). Anyone can help.

Hamid Muili

I am having a bit problem with working with daily date.. I kept getting error using formatts (line 59) . Time step must be constant.. I am using date that looks like 25-Oct-2015..

Great toolbox. I thank Grinsted for helping me finished my thesis about paleo-drought in Maritime Continent!

Zeeshan Fareed

I need to now how could I plot Partial and Multiple wavelet coherence? Please help me to plots.

Ximing Chen

Excuse me, I just want to inquire how to change 'period/scale' to frequency?

zhaochen Li


Juliana Guerreiro

How to change period/scale?

Vinit Sehgal

Kaniska Samanta

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?


How to change the scale?

Elizabeth Lyde

Maria Parfenova

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)

How to bring the code back to life?


Benjamin Norris

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:
> 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?


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)
Error in wtcsignif (line 119)
Error in wtc (line 163)

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


God bless you.

Aslak Grinsted

@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.


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?


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

erhan mugaloglu

useful for any discipline


Great job, thank you!

junjun shi


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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!