MATLAB Answers

How to do subplot using cwt()

37 views (last 30 days)
Hey, I would like to plot a 3*3 subplots containing 9 figures from cwt(). However, I found it impossible to do that by simply doing
My guess is that we have to manually extract the cwt features and plot by ourselves under the subplot(). If yes, could anyone share a sample code for this part? If not, what should I do to draw such a subplot?
Thank you very much!
Walter Roberson
Walter Roberson on 7 Mar 2021
Ah, I see what you mean. The code specifically clears the current figure before plotting.
In some cases, the code creates two axes, but I have not figured out yet which cases that corresponds to.
The code is taking the wavelet transform information (what would normally be the first output) and abs() it, and effectively does an imagesc() of that.

Sign in to comment.

Accepted Answer

Monisha Nalluru
Monisha Nalluru on 11 Mar 2021
Hi Shengjie,
cwt() would support subplots only with complex valued input signals that will plot the analytic and anti-analytic parts into seperate subplot.
In all other case, the output of cwt can be used with surface,pcolor or image to produce similar plot
As an example
load mtlb
[wt1,f1] = cwt(mtlb,'bump',Fs);
shading interp;
[wt2,f2] = cwt(mtlb,Fs);
shading interp
Example cwt supporting subplots for complex valued iput ,
load npg2006;
plot(; hold on; grid on;
xlabel('Eastward Displacement (km)');
ylabel('Northward Displacement (km)');
'markerfacecolor',[1 0 0 ]);
Hope this helps!
Shengjie Gao
Shengjie Gao on 11 Mar 2021
Hey Monisha,
Just a quick follow-up. Could you tell me how to modify both the xy-axis to the time-frequency range and also add the colorbar based on the magnitude?
Really appreciate your help!

Sign in to comment.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!