Average and error bars in Matlab for a complex array

5 ビュー (過去 30 日間)
Auryn_
Auryn_ 2018 年 5 月 30 日
コメント済み: Auryn_ 2018 年 5 月 30 日
Hi,
I have a function M that is an 4-D complex variable of dimensions a*b*c*d.
Now I want to average over the last dimension only, resulting in an array Mean=a*b*c.
I understand this is done with:
Mean=mean(A,4)
I want to show the error bars for this function, that is, the standard error.
What I have done is:
R = sqrt(Mean/(d-1));
Error=R/sqrt(length(d));
Now I have to rescale the parameters for my problem:
for it=1:length(c)
for r=0:a-1
Err(r+1,it)=sum(diag(Error(:,:,it),r))/(a-r);
end
end
for it=1:length(c)
for r=0:a-1
Value(r+1,it)=sum(diag(Mean(:,:,it),r))/(a-r);
end
end
And I plot:
errorbar(1:a,Value(1:a,end),Err(1:a,end))
Is this correct?
Thanks in advance!
  2 件のコメント
Stephen23
Stephen23 2018 年 5 月 30 日
編集済み: Stephen23 2018 年 5 月 30 日
"I have a function M that is an 4-D complex array..."
A function is not an array in memory. M is likely to be a variable.
Auryn_
Auryn_ 2018 年 5 月 30 日
Corrected

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

回答 (1 件)

Stephen23
Stephen23 2018 年 5 月 30 日
編集済み: Stephen23 2018 年 5 月 30 日
MA=mean(A,4)
"Is this correct?"
Yes.

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by