caluculating standard deviation for a vector

2 次查看(过去 30 天)
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 个评论
Jan
Jan 2013-4-16
"Around 50" values? Wouldn't it be easy to find out, how many values you get?

请先登录,再进行评论。

回答(1 个)

Jan
Jan 2013-4-16
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(:));

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by