Borrar filtros
Borrar filtros

caluculating standard deviation for a vector

2 visualizaciones (últimos 30 días)
mahesh bvm
mahesh bvm el 16 de Abr. de 2013
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 comentario
Jan
Jan el 16 de Abr. de 2013
"Around 50" values? Wouldn't it be easy to find out, how many values you get?

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 16 de Abr. de 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(:));

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by