Frequency axis on a scalogram

13 vues (au cours des 30 derniers jours)
Katrine
Katrine le 5 Mar 2012
Hi, I am trying to plot a scalogram with a time abcisse and a pseudo-frequency axis in a subplot with the time-signal and a spectrogram. Until now it has been possible for me to change the values of the scale-axis, but I cannot get the right values (calculated by hand and by scal2frq) to show on the axis.
Beneath is a cutout from the code for sub plotting the scalogram:
TAB_Sca2Frq = scal2frq(scales,'morl',1/fs); % Calculates pseudo-frequencies
coefs = cwt(signal,scales,'morl'); % Wavelet coefficients % equation: (centfrq('morl')./((scales)*(1/fs)) Sfre = centfrq('morl')./([1:128]*1/fs); % Sfre: Pseudo-frequencies calculated using center frequency for a morlet mother wavelet.
% Calculating the scalogram SCimg = wscalogram('image',coefs,'scales', scales,'ydata',signal);
subplot(312) imagesc(t,TAB_Sca2Frq,SCimg); set(gca,'yticklabel',TAB_Sca2Frq)); % changes the y axis
How can i make sure that the scale-axis has all of the right values (the pseudo-frequencies) from the TAB_Sca2Frq-string?
Hope you can help me!
Thank you
- Katrine

Réponse acceptée

Wayne King
Wayne King le 5 Mar 2012
Hi Katrine, I think the thing to do is call wscalogram() with an empty string for the plot type and just get the scalogram output, which you then plot yourself.
t = linspace(0,5,5e3);
x = cos(2*pi*100*t).*(t<1)+cos(2*pi*50*t).*(3<t)+0.3*randn(size(t));
COEFS = cwt(x,1:32,'cgau4');
F = scal2frq(1:32,'cgau4',0.001);
sc = wscalogram('[]',COEFS,'scales',1:32);
imagesc(t,[],sc);
indices = get(gca,'ytick');
set(gca,'yticklabel',F(indices));
xlabel('Time'); ylabel('Hz');

Plus de réponses (0)

Catégories

En savoir plus sur Wavelet Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by