Setting a plot's x-axis by units and not finer data points?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a simple issue but I can't seem to ask the right question to find it on Google or this community.
I have the data for a function over 10 seconds, recorded in 10 ms steps. This leaves me with 10000 data points.
When I plot it, the x axis uses the data points and goes from 1 to 10000, but I would like the axis ticks to be for seconds, not thousands of seconds.
What's the easiest way to fix this?
0 Kommentare
Antworten (1)
Steven Lord
am 7 Sep. 2021
When you call plot with one data input, the indices of the elements in the vector are used as the X coordinates.
plot((1:10).^2, '-o') % uses 1:10 as the X coordinates
When you call plot with two data inputs, the first is used as the X coordinates and the second the Y coordinates.
plot(11:20, (1:10).^2, '-o') % uses 11:20 as the X coordinates
0 Kommentare
Siehe auch
Kategorien
Mehr zu Polar Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

