フィルターのクリア

how to find the mean values betwwen 3 matrix?

1 回表示 (過去 30 日間)
aya ben mabrouk
aya ben mabrouk 2016 年 6 月 10 日
回答済み: Star Strider 2016 年 6 月 11 日
Hello everyone, I have three matrix A, B and C (size 1000*1000), I want to generate a new matrix D that contain average values between A, B and C. For more clarification, there is a little example :
A= [1,2,8; 5,6,7;7,5,8]
B=[0.2,5,1; 0.55,8,4;55,7,9] =====> D=[0.2,2,1;0.55,6,4;0.6,5,1]
C=[1,5,7; 2,6,8;0.6,7,1]
Please, How can I do it?

採用された回答

Star Strider
Star Strider 2016 年 6 月 11 日
This works:
A= [1,2,8; 5,6,7;7,5,8];
B=[0.2,5,1; 0.55,8,4;55,7,9];
C=[1,5,7; 2,6,8;0.6,7,1];
Cat = cat(3, A, B, C);
D = min(Cat, [], 3)
D =
0.2 2 1
0.55 6 4
0.6 5 1
Your desired result is not the average or mean values, but the minimum or min values.
If you actually want the average or mean values, change the ‘D’ assignment to:
D = mean(Cat, 3)
I separated out the concatenated matrices, ‘Cat’ assignment so you could see how the code works. You can of course combine them ionto one statement.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by