Borrar filtros
Borrar filtros

how to find the mean values betwwen 3 matrix?

1 visualización (últimos 30 días)
aya ben mabrouk
aya ben mabrouk el 10 de Jun. de 2016
Respondida: Star Strider el 11 de Jun. de 2016
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?

Respuesta aceptada

Star Strider
Star Strider el 11 de Jun. de 2016
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.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices 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