Hi,
I am very new to matlab... I have a 1D array of 45000 points they are sampled at 256Hz.
Now i want to plot the 1D array but on my x-axis i want to display the actual time, so 45000 * 1/256. How do i scale my x-axis?
Best regards, Thijs

 Accepted Answer

dpb
dpb on 24 Oct 2016
Edited: dpb on 24 Oct 2016
Simplest (at cost of some extra memory) is to just define a t vector to plot against...
t=linspace(0,(length(data)-1)/256,length(data)); % set start,stop times, compute interval
or
t=[0:1/256:(45000-1)/256]; % set start, dt, compute end time
NB: the "-1" on overall duration since there's one fewer dt intervals than number of elements in vector...

More Answers (0)

Asked:

on 24 Oct 2016

Edited:

dpb
on 24 Oct 2016

Community Treasure Hunt

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

Start Hunting!