caluculating standard deviation for a vector

3 views (last 30 days)
Hi all,
I have a vector of 20 by 1000 and wanted to calculate standard deviation for this vector in the below specified manner
a) Initially I need to calculate standard deviation for every 20 points beginning from 20 to 1000 for every row.
b) This should give around 50 standard deviations for each row. This needs to be computed for all the 20 rows.
b) Later I need to add all 50 standard deviations of every row, which should deliver one final value for each row. So for 20 rows, there would be 20 such finally summed standard deviations.
Kindly help, I really appreciate the help. Thank you.
  1 Comment
Jan
Jan on 16 Apr 2013
"Around 50" values? Wouldn't it be easy to find out, how many values you get?

Sign in to comment.

Answers (1)

Jan
Jan on 16 Apr 2013
I guess, you want the deviation in blocks of size 20 from column 21 (not 20!) to 1000?
x = rand(20, 1000);
y = reshape(x, 20, 20, 50);
% Or perhaps you want to omit the first 20 columns:
% y = reshape(x(:, 21:1000), 20, 20, 49);
ys = std(y, 0, 2); % Std over 2nd dimension
r = sum(ys(:));

Categories

Find more on Spline Postprocessing 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!