# Math Help - matlab changing time scale on a waveform

1. ## matlab changing time scale on a waveform

hi,

i have a waveform which i have read in using matlab.

fs = 200, waveform length = 20s.

if i read in waveform and plot() it, without setting 't', matlab will auto generate a scale from 0 to 4000

using plot(waveform(1800:2200)) will show me 2 cycles.

and i can plot the full waveform with correct time scale by t=(0:length(ecgclean)-1)/fs;

but how can plot waveform only over 2 cycles using the correct time scale?

arghh, i know it will be trival but i just cant get it work!

thanks for any help

2. Originally Posted by edm
hi,

i have a waveform which i have read in using matlab.

fs = 200, waveform length = 20s.

if i read in waveform and plot() it, without setting 't', matlab will auto generate a scale from 0 to 4000
No it won't look more closely the scale runs from 1 to the number of sample points.

CB

3. Originally Posted by edm
hi,

i have a waveform which i have read in using matlab.

fs = 200, waveform length = 20s.

if i read in waveform and plot() it, without setting 't', matlab will auto generate a scale from 0 to 4000

using plot(waveform(1800:2200)) will show me 2 cycles.

and i can plot the full waveform with correct time scale by t=(0:length(ecgclean)-1)/fs;

but how can plot waveform only over 2 cycles using the correct time scale?

arghh, i know it will be trival but i just cant get it work!

thanks for any help
Code:
ddata=ecgclean(1800:2200);
plot([0:length(ddata)-1]/fs,ddata);
CB

4. great, thanks for you help CB!