# Finding the standard deviation for every single value in a matrix

20 ビュー (過去 30 日間)
Abdulhakim Alezzi 2020 年 5 月 5 日
コメント済み: Matt J 2020 年 5 月 5 日
Hi Everyone,
I have a 10 matrices X1, X2,X3......X10. Each matrix has a size of (512x30).
1- i want to calculate the mean for all , and the output matrix must be in the same size as input (512x30).
2- Then, i want to calculate the standard deviation for all , and the output matrix must be in the same size as input (512x30).
Any help will be apperciated.
##### 3 件のコメント表示非表示 2 件の古いコメント
Abdulhakim Alezzi 2020 年 5 月 5 日
I have used these functions, i have calculated the mean and std by :
mymean= mean (x);
mystd= std (mymean);
but the output was a matrix of (1x30).

サインインしてコメントする。

### 採用された回答

Matt J 2020 年 5 月 5 日

X=cat(3, X1,X2,X3,X4,X5,X6,X7,X8,X9,X10); %It was a mistake to create 10 separate matrices.
MeansX=mean(X,3),
StdX = std(X,[],3)
##### 5 件のコメント表示非表示 4 件の古いコメント
Matt J 2020 年 5 月 5 日
Well as before, you should not have 10 separate variables. You should have a 4D array containing all of your data and then just take std() along the 4th dimension, e.g.,
A=rand(30,30,512,10);
B=std(A,[],4);

サインインしてコメントする。

R2019a

### Community Treasure Hunt

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

Start Hunting!

Translated by