mean value of each row
Mostrar comentarios más antiguos
I have A 500 by 16 matrix and I want to find a mean value of each row and return the result as a 500 by 1.
Does anyone have an idea?
Thank you
2 comentarios
Walter Fanka
el 15 de Jul. de 2018
Editada: Walter Roberson
el 17 de Jul. de 2018
y = yourmatrix;
meanrow_y = mean(y')'
Walter Roberson
el 17 de Jul. de 2018
That should work for 2D arrays like were asked about. However for 3 or more dimensions it would not work and you would need to use a couple of permute() instead. It is a lot easier to just pass in the dimension number like I showed in my Answer.
Respuesta aceptada
Más respuestas (2)
sura Naji
el 25 de Oct. de 2019
1 voto
l have amatrix contact from 1 colum and 1000 rows l want to find the mean and the standard deviation also l want to find the worst value of this because l use the particle swarm optimization
1 comentario
Walter Roberson
el 22 de Dic. de 2019
M = mean(amatrix);
S = std(amatrix);
[~, order] = max(abs(amatrix - M));
furthest_from_mean = amatrix(order(1));
Note that the value that is furthest from the mean will also be the value that is the greatest zscore (furthest deviation)
RAMPUNIT KUMAR
el 2 de Sept. de 2021
0 votos
RAMPUNIT KUMAR less than a minute ago ⋮ I too have a doubt, like for matrix (a b c d e f g h I j k l m n o p q r) I need to find the mean of a,b then c,d then e,f then g,h and so on upto last element. How could we do that if size is big enough.
1 comentario
syms a b c d e f g h I j k l m n o p q r
matrix = [a b c d e f g h I j k l m n o p q r]
means = (matrix(1:2:end) + matrix(2:2:end))/2
except that you would use the appropriate numeric values in matrix instead of syms . The syms used here is just for demonstration purposes.
Categorías
Más información sobre Parallel Computing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
