caluculating standard deviation for a vector

2 ビュー (過去 30 日間)
mahesh bvm
mahesh bvm 2013 年 4 月 16 日
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 Center および File ExchangeSpline Postprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by