How to calculate the mean of multiple matrices (with different size)?

Hi all
I have multiple matrices, where the second dimension is of different size for each matrix. Here I add an example: Matrix A (128 x 2337) Matrix B (128 x 2828) Matrix C (128 x 2067)
Now I would like to calculate the mean over the second dimension over all matrices, so that the resulting averaged matrix for example looks like Matrix D (128 x 2000).
This may probably require to normalize the second dimension?
How would you do it? Many thanks in advance! Any tip is very appreciated. Liso

 Risposta accettata

The mean over the second dimension is
theMeanA = mean(matrixA, 2);
theMeanB = mean(matrixB, 2);
theMeanC = mean(matrixC, 2);
These are all 128 by 1 column vectors. So, now, how exactly are you expecting to arrive at D which is a 128 by 2000 matrix? Do you have 2000 matrices that you are going to take the mean of?

Più risposte (2)

Thanks for your fast answer!
The column vectors are actually the time dimension. I would like to arrive at D so that the column vectors are the averaged values over a normalized time of each of the matrices. 128 x 2000 was jsut an example, it could also be 128 x 100 etc.
I hope this calrifies my question. Please let me know if this in understandable.
lisa

1 Commento

(This question is not solved yet, I accidentially hit the accept button -)

Accedi per commentare.

ok, I think I now understood what I was thinking wrong.
Of course, I want to end up with an averaged matrix of 128 by 1 column vectors. The main idea is that each column of the averaged matrix should be the mean of the input matrices. The lenght of the columns in the averaged matrix could be for example 2000 data points.
lisa

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by