error plotting, but succed when plotting order is change
4 次查看(过去 30 天)
显示 更早的评论
I am tring to plot instantaneous freq using code below,
subplot(311),instfreq(signal,srate,'Method','hilbert');
subplot(312), plot(t(1:end-1),instFreq1)
subplot(313),instfreq(signal,srate,'Method','tfmoment');ylim([0 25])
it can show two first figure but failed to plot last figure, so i change the order or plotting as
subplot(313),instfreq(signal,srate,'Method','tfmoment');ylim([0 25])
subplot(312), plot(t(1:end-1),instFreq1)
subplot(311),instfreq(signal,srate,'Method','hilbert');
ait it work, con someone explain why it happend? the error msg that i get is
Error usingenableLegacyExplorationModes
Custom axes toolbar found. Call
enableLegacyExplorationModes before
customizing the axes toolbar
Error insignalwavelet.internal.convenienceplot.plotTFR
(line 99)
enableLegacyExplorationModes(hFig);
Error ininstfreq>displayInstFreqSpectrum (line279)
signalwavelet.internal.convenienceplot.plotTFR(T,
F, 10*log10(abs(P)+eps), ...
Error in instfreq (line 128)
displayInstFreqSpectrum(Time,
instfreq, opts.Power, ...
Error in Exp_code_ch8_instantfreq
(line 40)
0 个评论
采纳的回答
Prasanna
2024-3-26
Hi,
The error you're encountering is related to how MATLAB's graphics system handles the customization of toolbars and interaction modes within figures when using certain plotting functions. Specifically, the “instfreq” function, when used with certain methods like “tfmoment” may internally modify the figure's toolbar or interaction modes to better display and interact with the time-frequency data. This modification seems to conflict with subsequent or previous subplot customizations if not handled in the right order or without proper preparation.
When you plot the subplot using “tfmoment” first (“subplot(313)” in your reordered code), MATLAB sets up the figure's toolbar and interaction modes as needed by the “instfreq” function right at the beginning. After this setup, adding more subplots does not seem to conflict with the already established settings, allowing the other plots to be added without issue.
However, when you try to use “tfmoment” after plotting other subplots, MATLAB attempts to modify the figure's toolbar or interaction modes again, which leads to a conflict because the figure has already been partially customized by previous plotting commands which in turn throws the error message.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!