Problems with a plot

Hi,
I want to plot in Matlab the frequency of a system (vector of dimension of 1800000 * 1) between 11:00 am and 16:00 pm. My time vector has also a dimension of 1800000 * 1, containing the time sampled in milliseconds (there are 100 samples for each second). I would like to plot all the frequency with the time axis showing the time (i.e. 11:00 – 11:10 - … 16:00) but not showing the milliseconds. How can I do that?
Thank you

1 Kommentar

dpb
dpb am 26 Feb. 2015
...time vector ... of 1800000 ... to plot all the frequency with the time axis...
Let's see...your display might have something like 2000 pixels in the x direction? That'd mean about
>> 1800000/2000
ans =
900
>>
points per pixel at best. Methinks that's probably overdoing it somewhat as to what it makes any real sense to plot. Either decimate the vector by sample at (say) 900 as
plot(t(1:900:end),signal(1:900:end))
to get roughly 2000 points plotted or, if you really think you might miss an important feature/peak bound somewhere in that unsampled section, keep only the max(abs(signal)).*sign(signal) over that grouping.

Antworten (1)

dpb
dpb am 26 Feb. 2015

0 Stimmen

Just answered very similar question at
The frequency is different but the ideas are the same, just fixup the axis tick values to match what you want instead of the two hours there. Note, however, that unless you spread the axis on a wide monitor you'll probably have more than you can accommodate at 10-min intervals. But, "salt to suit"...

2 Kommentare

Claudia Rahmann
Claudia Rahmann am 26 Feb. 2015
Thank you for the answer, it was very useful. However, I could not fix the x-axis between 11:00 am and 16:00 pm, the plot starts at hour 00:00 and finishes at 05:00. Moreover, if I want to set tick marks every ten minutes, how should I use the 'xtick'? Thank you again!!
dpb
dpb am 26 Feb. 2015
Show your work...can't see your monitor from here.
What is the initial/last time series value and where(to what values)/how did you set the axes limits?
Show the datetick command and relevant sections around it...

Diese Frage ist geschlossen.

Tags

Gefragt:

am 26 Feb. 2015

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by