Average vector of an array

4 visualizaciones (últimos 30 días)
Karim ElShorbagi
Karim ElShorbagi el 22 de Nov. de 2020
Comentada: Karim ElShorbagi el 22 de Nov. de 2020
So if I have a 6x2 array, lets say:
[0 0 0 0 0 0]' and [2 2 2 2 2 2]'
how do I use matlab to find an average vector of these vectors so that it returns for example [1 1 1 1 1 1]'?

Respuestas (2)

Ameer Hamza
Ameer Hamza el 22 de Nov. de 2020
You can specify the dimension in mean() function. For example
x = [0 2;
0 2;
0 2;
0 2;
0 2;
0 2];
y = mean(x, 2)

dpb
dpb el 22 de Nov. de 2020

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by