Set axis to plot data against a specific scale
1 view (last 30 days)
Show older comments
I have about 16000 rows of data that are taken like 1 sec apart, but i want to plot them over the number of days that the this occurs. what do i input into matlab to make it stop plotting by number of data points on the x axis and instead replace the xaxis with an arbitrary scale.
For example if I want to plot all 16000 from 0-1 on the x axis, i want each data point to correspond to 1/16000 on the x axis. Since the number of data points changes all the time from file to file how can I make it adjust the scale so that it is always properly done?
0 Comments
Accepted Answer
Chad Greene
on 8 Oct 2014
If your 16000 rows of data are described by y, try this:
x = linspace(0,1,length(y));
plot(x,y)
The linspace function evenly spaces from the first argument (0 in the case above) to the second argument (1 in the case above) using the third arument (the length of y) as the number of steps.
0 Comments
More Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!