How to calculate each consecutive 2data standard deviation

1 view (last 30 days)
Hi,
I have the below data:
0.12 0.235 0.362
0.125 0.254 0.362
0.131 0.254 0.356
0.235 0.254 0.563
0.326 0.258 0.635
0.362 0.562 0.635
0.362 0.562 0.635
0.523 0.568 0.725
0.555 0.598 0.789
0.555 0.598 0.568
0.555 0.598 0.568
0.555 0.598 0.568
0.555 0.598 0.568
0.555 0.598 0.568
0.555 0.598 0.568
0.555 0.598 0.568
Want to calcaulate STD of each two consecutive data by column.
Kindly help someone, many thanks in advance,

Answers (1)

Walter Roberson
Walter Roberson on 19 Nov 2017
reshape( std(reshape(YourData, 2, size(YourData,1)/2, size(YourData,2))), [], size(YourData,2))
or
abs(YourData(1:2:end,:) - YourData(2:2:end,:))/sqrt(2)
The second of these works because the standard deviation between exactly two values X and Y is abs(X-Y)/sqrt(2)
  2 Comments
Mekala balaji
Mekala balaji on 19 Nov 2017
Thanks Sir, But I just wonder will it work for the odd data size(size is 21, not divisible by 2)
Walter Roberson
Walter Roberson on 19 Nov 2017
You have not defined the result that you want for the isolated row.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!