Clear Filters
Clear Filters

Overlap in the mscohere function

4 views (last 30 days)
Eric
Eric on 24 May 2015
Commented: baba on 8 Sep 2017
Hi everybody,
I'm calculating the magnitude-squared coherence for signals like:
[Cxy,F] = mscohere(xdata,ydata,[],noverlap,[],samp_rate);
With the window size being the entire length of the data [] (one second here), f as default and sampling rate at 200 (same as data). However, even though the window size is the same length as the data I can change the result by inserting different values in 'noverlap'.
How can that be? Does it make sense to use 50% overlap when the window size is the same as data length?
Best,
Eric
  2 Comments
Edinburgh
Edinburgh on 13 Aug 2015
Hallo Eric, You probably had an answer for your question but I will give you my suggestion anyway. It might help someone else in the future :).
First, taking the window size equal to the length of your data is wrong. In fact, the window size is a function of your sample frequency, and the frequency you want to resolve while using the function mscohere. Let's say the data is collected at 50 Hz and you want to resolve the coherence between two time series at 0.5 Hz, then you will need a window length = 50/0.5 = 100 samples. In practice, it is ALWAYS better to multiplied this value by 4 or 5 so to be sure that the desired frequency falls within the frequency bin. Therefore, your window length = 400 or 500.
Now, concerning the noverlap question. Depending on how noisy is your signal, increasing the noverlap size will decrease the noise variance. If your signal is a clean one, perhaps an overlap = 0 or 10% would not change anything. I suggest, you play with the noverlap to see which value corresponds best in your case.
Taking your example,
for noverlap = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.9]*window_size
mscohere(xdata,ydata,[],noverlap,window_size,samp_rate);
end
I hope this help.
Best regards, Axel
baba
baba on 8 Sep 2017
This is a very well explained answer. Thanks Axel.

Sign in to comment.

Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!