Saturday, 28 March 2015

Wavelet Coherence using Matlab

1. Import your data: as column vectors --> OK,

2. Download WTC (wavelet coherence) package and unzip:
http://noc.ac.uk/using-science/crosswavelet-wavelet-coherence



3. Attach the package to Matlab:
Locate the folder with WTC package. List of files with codes will appear in the Current Folder field.

4. Run the code: Type wtc code with a pair of variables and click ENTER. For example:
wtc(VariableA, VariableB)

5. Add a title and grid:
title('Variable A vs Variable B')
grid on

Done! Here you'll get a colourful figure with red and blue spots.


Download the manual: HERE

________________________
Tip: to extract 1-year scale data (assuming you have daily data: 1 year = 252 days), run the following code:
                                                 myvariable=cwt(VariableA, 252, 'db4')

where: 
- VariableA is your variable name from the dataset,
252 is the wavelet scale (252 days scale - if you have daily data),
- 'db4' is type of wavelet filter.

_______________________________________________________________