how to adjust Axis limit for wavelet transform plot?

2 ビュー (過去 30 日間)
Dolly More
Dolly More 2023 年 7 月 26 日
回答済み: Vitek Stepien 2023 年 9 月 5 日
HI, I have used a daily time series of nine years and detrended it to get wavelet transform. I am trying to limit my wavelet transform from 32 to 4096 (days) period.
I used xlim[32 4096], and also used exact value from the output array(period) from function "wt".
Both way the plot gets blanked. I understand that the plot is going out of the frame and thatswhy I am not getting error in command window too.
Please let me know if there is any way to do adjust axes in such case. Thank you!
  3 件のコメント
Dolly More
Dolly More 2023 年 8 月 10 日
編集済み: Dolly More 2023 年 8 月 10 日
Hi, the code I used is as follows and I have attached the figure image for your reference too.
sal_det= detrend(sal);
figure;
[wave,period] = wt(sal_det); % top left image
ylim([32 1024]) % Case 1
ylim([period(1,25) period(1,98)]) % Case 2
For both the cases, my plot is going out of frame (top right tile of the image)
Also, I wanted to change the Yticks using,
yticks([2.^(4.322) 2.^(4.9) 2.^(6.49) 2.^(7.5) 2.^(8.51) 2.^(9.51) 2.^(10.51)])
% Calculated 2 power for the specific period
% ( in my case its days: 20, 30, 90,180,365,730 and 1095) to represent it in years
yticklabels({'0.05','0.08','0.24','0.5','1','2','3'}) % (years)
But the ytick values are just disappearing and nothing new getting replaced (bottom left image).
I could just replace the tick value for the default values on Yaxis to represent it in years by using
ytickslabels({'0','0.02','0.04','0.08','0.17','0.35','0.7','1.4','2.8','5.6'})
% bottom right image
Please let me know if you could help me with these issues. Thank you!
Nivedita
Nivedita 2023 年 9 月 5 日
Hi Dolly,
Can you provide the dataset that you are working on? It is quite difficult to figure out what exactly is causing the figure to not fit in the axes and why the "yticks" is behaving in a weird manner.

サインインしてコメントする。

回答 (1 件)

Vitek Stepien
Vitek Stepien 2023 年 9 月 5 日
Hi Dolly,
I had the same problem, in my case it turned out that when using wcoherence without output arguments to plot it automatically, my y-values were very weird and I had to convert them to my actual values.
One solution would be to use wcoherence with output arguments and plot it manually, but you loose the phase arrows, so that's not an option if you care about that.
The other solution is to figure out the conversion, as I mentioned above. Try the following commands, right after your wcoherence line:
ax = gca;
figure, plot(ax.YTick)
This will show you the relationship between YTick values. If the values are very low, then perhaps they are log of your actual values. If so, try the following, with Fs being your frequency band (inverse of time step).
ytick_mod = Fs*round(pow2(ax.YTick));
ax.YTickLabel = ytick_mod;
You should be able to figure out the rest, because it depends on your actual data and what you want to do with the labeling. Let me know if it helped!

カテゴリ

Help Center および File ExchangeContinuous Wavelet Transforms についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by