time average of every 100 samples

hello all,
I have 4000 samples of data, and I want to take time average of every 100 or 99 samples and put the result in 100th position of another array.
Thanks in Advance.

2 Comments

Thanks for quick replies, but I do not want to reshape my vector. I think I should add zeros in between and make the result after every 100 samples.
huh? If you do what I did, your vector is not reshaped outside of the calculation of the averages. the averages is what you're looking for per your description.

Sign in to comment.

Answers (2)

averages = mean(reshape(x(:),100,[]))
Something like this?
You can do something like this:
x = randn(4000,1);
x1 = reshape(x,100,40);
y = mean(x1);
Now you have the mean of every 100 samples. You can now put those values in another array as you wish.

Tags

Asked:

on 23 Feb 2012

Edited:

on 22 Oct 2013

Community Treasure Hunt

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

Start Hunting!