MATLAB: Limiting standart deviation of a signal

limitstandart deviation...std

Hi all,
i have a really easy question. I need std() command to limit. So i have a signal as name ST (on y axis) and time (on x axis) and time is from 0 to 10 seconds. But i need to find standart deviation of signal just between 0 to 3 seconds. You can see my graph.
I would be very appreciated for your answers. Thanks a lot!

Best Answer

Let's say your time variable is
time = 0:.1:10;
and your data is named 'data'.
First locate all time samples between 0 and 3 sec
idx = time >= 0 & time <= 3;
Then calculate std of your data for those times.
sig = std(data(idx));
This can be done all in 1 line like this
sig = std(data(time >= 0 & time <= 3));
*This assumes your 'time' and 'data' points correspond.