Effacer les filtres
Effacer les filtres

How to remove mean from matrix values?

8 vues (au cours des 30 derniers jours)
jack star
jack star le 14 Mai 2016
Commenté : jack star le 14 Mai 2016
Hi all. I have M(80x200) matrix. I found mean A=mean(M) for every column so I have A(1x200) matrix. Now I want to subtract means from each values on every columns.
I guess if I turn A matrix into (80x200) then I can M-A

Réponse acceptée

Geoff Hayes
Geoff Hayes le 14 Mai 2016
jack - you can use a for loop to subtract the mean matrix A from each row of M. Something like
for k=1:80
M(k,:) = M(k,:) - A;
end
Or, you can use repmat to repeat copies of your A to get an 80x100 matrix as
M = M - repmat(A,80,1);
Try either of the above and see what happens!
  1 commentaire
jack star
jack star le 14 Mai 2016
Both works fine. Thanks.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by