how to adjust Axis limit for wavelet transform plot?

2 Ansichten (letzte 30 Tage)
Dolly More
Dolly More am 26 Jul. 2023
Beantwortet: Vitek Stepien am 5 Sep. 2023
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 Kommentare
Dolly More
Dolly More am 10 Aug. 2023
Bearbeitet: Dolly More am 10 Aug. 2023
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 am 5 Sep. 2023
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Vitek Stepien
Vitek Stepien am 5 Sep. 2023
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!

Kategorien

Mehr zu Continuous Wavelet Transforms finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by