Discrete wavelet decomposition (wavedec) using less than 365 days per year

Hi!
I am trying to run a wavelet coherence analysis of daily streamflow from two gage stations. I have for each year daily streamflow from October and November (61 days) over a period of 75 years, that means that I have daily flow only for 61 days a year. This results on 4575 daily flows (75 years x 61 days) in each station.
When I run the wavelet coherence analysis using the 4575 samples I got the following image
However, I do not know how to convert the Normalized Frequency (cycles/sample) to period of years?
I want to understand how coherent were the daily streamflow data for October and November (the fall season) of each year for different periodicities of 1 year, 2years, 4years, and 8years.
How can i understand this normalized frequency?
Thank you for the help!

10 Kommentare

i guess you sticked the daily recording of all 75 years together. to get from normalized frequency to actual frequency, you have to multiply by you sampling frequency. but look into the Matlab function description, there you can normally enter the sampling frequency! which function did you use?
Hi Jonas, thank you!but I am not sure how you mean I should do, could you make a practical example? I am using the wcoherence function
if you compare data from year a with data from year b you use
[wcoh,wcs,f] = wcoherence(x,y,fs)
with fs beeing the sampling frequency in Hz. Your sampling frequency was 1/day, which equals 1/(24*60*60s)
use that value for fs
another possibility to compare the data for each year, is to stick them together to one vector and calculating e.g. the spectrogram or the cwt of the sticked vector. maybe you want to window each year's data using e.g. a hann() window of length 61 to remove harsh transitions (leading to high frequencies) between the years
hann(61).*[year1;
year2;
year3;
...
];
year1 e.g. a row vector here
how did you use the wcoherence function on all 4575 samples?
Hi Jonas,
I am doing the following and please correct me if i am wrong:
I have 61 samples per year, then to estimate the frequency I did the following:
61 (samples / year) * (1 year / 365 days) * (1 day / 24 hours) * (1 hour / 3600 seconds) = 1.9343 E-6 (samples / seconds) or what it is the same 1.9343 E-6 Hz
Then, I calculate the wcoherence function as:
wcoherence(upstream,downstream,0.0000019343)
where I put the two signals (upstream and downstream) and at the end the frequency in Hz as they do here in the Effect of Sampling Frequency on Wavelet Coherence: https://www.mathworks.com/help/wavelet/ref/wcoherence.html
Doing that, I got the following figure:
Then to transform the frequency of the Y axes that it is in nano hertz (nHZ). I did the following knowing that 1 nHz = 1.0E-9 Hz and time = 1 / frequency:
For example to convert 64 nHZ to time in seconds I did:
1 / (64 nHz * 1.0E-9) = 15625000 seconds
and from seconds to years:
15625000 seconds / (1 year * 365 days * 24 hours * 60 minutes * 60 seconds) = 0.495465 years
Therefore, 64 nHz corresponds to approximately half of a year.
I am sure there are simpler ways to do it, but this is how I figure out doing it!
Thank you for your help!
at the moment, you gave a sampling frequency of 61 per year. the problem is, that your 61 samples per year are not uniformly distributed over the year, but they are all taken within two months, so the samples are denser conpared of you stretch 61 samples over one year (which would equal a sampling period of 365/61=6 days). if you want the algorithm to know that these samples are denser, i would suggest that you pre and post pad your 61 samples with 0 such you get 365 samples per year. then you can give the the algorithm the sampling rate 1/day and it can account for the true sampling of 61 samples in two months
to make the y labels better readable i would suggest you generate new yticklabels() using your formular on yticks() and updating the ylabel() accordingly
I fill with zeros all the days of the year except the ones of my interest (October and November) where I keep the daily streamflow. Now, I have a total of 27394 days, and for october and november the same daily streamflow of the figure I put above.
I have re-run the wavelet coherence function over this new data but with the new frequency:
365 (samples / year) * (1 year / 365 days) * (1 day / 24 hours) * (1 hour / 3600 seconds) = 1.1574E-5
using the following expresion:
wcoherence(upstream,downstream,0.0000157431)
However, as you can see in the Figure, both of them look different for the same time periods (i.e. 2 years that corresponds to 0.015625 µHz in this figure or 16 nHz of the figure above).
I am confused about which one should i consider.
Thank you for your help!
hmm, ok, i guess the problem is, that the zero padded parts have a big influence on the calculation of the correlation. since the values are the same in the padded regions, the correlation values are much better there compared to the part in which you ate actually interested.
i would consider teo measures you can try (not both at the same time).
1. you could use ne non padded version and mutiply the y values by 6 manually (if this is a valid procedure I can't tell)
2. remove the image regions in which you padded with NaN values, leading to white regions and empty spacing in the appearance. but you may still see the edge effects.
another thing is your sampling frequency, you cut the 365 part here. sampling frequency in the second case is 1/d which equals 1/(24*60*60). you can see also that there must be an error since the x axis range is not correct
Hi Jonas!
Thank you for the feedback!
About the first approach to try, do you mean to multiply the nHz of the y axis in the frist Figure by 6, this will mean then 512 nHz * 6 = 3072 nHz?
I have tried to run the wcoherence function using 6 samples/year (365/61) with a frequency equal to:
6 (samples / year) * (1 year / 365 days) * (1 day / 24 hours) * (1 hour / 3600 seconds) = 1.9024E-7
wcoherence(upstream,downstream,0.000000190259)
and this is the resul I got, it is not correct because I got a time period of 700 years in the axis x.
I am not sure why you say "another thing is your sampling frequency, you cut the 365 part here. sampling frequency in the second case is 1/d which equals 1/(24*60*60). you can see also that there must be an error since the x axis range is not correct".
You are right on this affirmation, do you know where the problem may it come? I have 55 years, when I should have 75 years. I checked and I have as input 27394 days of streamflow that are equal to 75 years. I think the sampling frequency is correct that it is 1/(24*60*60) = 0.000015741
I am not into the idea of delete the part where I padded the zero values, I do not think I am going with that option.
I am not sure which approach to take now with these data.
I have re-run the wavelet coherence function over this new data but with the new frequency:
365 (samples / year) * (1 year / 365 days) * (1 day / 24 hours) * (1 hour / 3600 seconds) = 1.1574E-5
using the following expresion:
wcoherence(upstream,downstream,0.0000157431)
just an error from typing you forgot a 1
num2str(1/(24*60*60),'%.12f')
ans =
'0.000011574074'
About the first approach to try, do you mean to multiply the nHz of the y axis in the frist Figure by 6, this will mean then 512 nHz * 6 = 3072 nHz?
Yes, the first figure and the yticklabels changed by factor of 6 to compensate for the fact, that the data were taken ober two months only and not over a whole year. in addition, you can also change the yticklabels by your formular from nano Herz to years, to make it better readable
I have tried to run the wcoherence function using 6 samples/year (365/61) with a frequency equal to:
6 (samples / year) * (1 year / 365 days) * (1 day / 24 hours) * (1 hour / 3600 seconds) = 1.9024E-7
i think this does not make sence.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Wavelet Toolbox finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 25 Jun. 2022

Kommentiert:

am 30 Jun. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by