How do I create a matrix that is only the frequencies within the COI of a wavelet transform coherence?
Show older comments
I am measuring the wavelet transform coherence of two signals (x and y). I then am trying to take the average coherence within various frequency ranges. However, I only want to measure the coherence values within the cone of influence COI. How do I do this?
Currently I have the two signals and then conduct the wtc. The signals are attached as files
% define parameterts and signals
ts = 0.1; % time step
fs = 10; % frequency in Hz
t = (0:length(x) - 1)/10; % time vector
[wtc, f, coi] = wcoherence(x, y,fs);
Next, I assume I would create the matrix that is the coherence values within the cone of influence.
coiDatamatrix = ?? % a matrix of only the wtc values within the coi
Finaly, I would take the average coherence within the frequency range 0.125-0.3 Hz
freqRange = [0.125 0.3];
% % Find indices corresponding to the frequency range
freqIndices = find(f >= freqRange(1) & f <= freqRange(2));
% Extract coherence values in the frequency range within the COI
coherenceInRange = coiDatamatrix(freqIndices)
% Calculate average coherence (ignoring NaNs)
averageCoherence = mean(coherenceInRange);
5 Comments
FsC
on 16 Nov 2023
Mathieu NOE
on 17 Nov 2023
Edited: Mathieu NOE
on 17 Nov 2023
hello
I don't have the Wavelet Toolbox with the wcoherence function
I could further help you if you share the output of your wcoherence computations as a mat file
FsC
on 17 Nov 2023
Mathieu NOE
on 20 Nov 2023
ok I think I got it to work now , see in the answer section below
Accepted Answer
More Answers (0)
Categories
Find more on Lighting, Transparency, and Shading 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!