MATLAB: Frequency axis on a scalogram

axisgraphicswavelet

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

Best Answer

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');
Related Question