How to set yaxis equal to each other in a subplot of two scalograms made from two different Motherwavelet?

Hi I am trying to subplot two scalograms made from two different mother wavelets (and therefore with two different center frequencies and scales-to-frequency ratios). I have converted the y axis to pseudo-frequencies and am now trying to set the y limits for each plot to have the same span. How do I manipulate the y axis so that the ymin and ymax are the same for both plots but the images (the scalograms) must correspond to the values of the pseudo-frequencies?
Any help is greatly appreciated Thank you - Katrine

 Accepted Answer

OK, so explain to me what is wrong with this. Yes, of course you will have to use different scale vectors for different mother wavelets if you really want to line the pseudo-frequencies up as much as possible. Also you may only care about them having the same range over a part of your frequency interval.
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));
COEFS1 = cwt(x,1:32,'cgau4');
F1 = scal2frq(1:32,'cgau4',0.001);
scgaus = wscalogram('[]',COEFS1,'scales',1:32, 'ydata', x);
COEFS2 = cwt(x,1.6:55,'morl');
F2=scal2frq(1.6:55,'morl',0.001);
scmorl=wscalogram('[]',COEFS2,'scales',1.6:55, 'ydata', x);
subplot(211)
mesh(t,F1,scgaus);
view(0,90)
set(gca,'ylim',[15 200])
title('Complex Gaussian Wavelet');
subplot(212)
mesh(t,F2,scmorl);
view(0,90)
set(gca,'ylim',[15 200])
title('Morlet Wavelet');

More Answers (1)

Hi Katrine, Have you tried
set(gca,'ylim',[minfreq maxfreq])
So something like:
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);
mesh(t,F,sc); view(0,90); set(gca,'ylim',[15 250]);
xlabel('Time'); ylabel('Hz');

4 Comments

Yes I have tried that.
And that does not work, because the scalograms are calculated from the same scales, and therefore the same pseudo-frequencies (value) in the scalogrmas do not match the same scales. Using set(gca,'ylim',[min max]) does unfortunately not give the right placement of the scalogram corresponding to the frequencies. Is it possible somehow to manipulate the axes in a subplot so that the y-axis of all graphs in the subplot have the same axis? Or is it possible to set the two center frequencies equal to one another for making sure that the pseudo-frequencies are the same in both scalograms corresponding to the same scales?
I think if you provide a small example it would be very helpful
Sorry for the bad explanation. In the following example I would like to have the same y-axis span for both plots in the subplots.
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));
COEFS1 = cwt(x,1:32,'cgau4');
F1 = scal2frq(1:32,'cgau4',0.001);
scgaus = wscalogram('[]',COEFS1,'scales',1:32, 'ydata', x);
COEFS2 = cwt(x,1:32,'morl');
F2=scal2frq(1:32,'morl',0.001);
scmorl=wscalogram('[]',COEFS2,'scales',1:32, 'ydata', x);
subplot(211)
imagesc(t,[],scgaus)
indices = get(gca,'ytick');
set(gca,'yticklabel',F1(indices));
subplot(212)
imagesc(t,[],scmorl)
indices = get(gca,'ytick');
set(gca,'yticklabel',F2(indices));
But this seems not to be possible because of the difference in center frequency and therefore in the relation of scales and pseudo-frequencies.
Thank you very much for all your help
The right pseudo-frequencies shall of course still match the values in the specific scalogram.

Sign in to comment.

Categories

Find more on Wavelet Toolbox 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!