(x̄ - μ) in MATLAB

If we define A to be a 3x3 matrix with scalar values, is this correct?
zscore(A) = (x̄ - μ)row 1 + (x̄ - μ)row 2 + (x̄ - μ)row 3
or is there a different function to calculate this in Matlab without doing it all step by step in a gigantic matrix?

 Risposta accettata

Mischa Kim
Mischa Kim il 17 Mar 2014
Modificato: Mischa Kim il 17 Mar 2014

0 voti

Ashley, zscore(A) can also be computed as
n = size(A,1);
zScoreA = (A - ones(n,1)*mean(A))./(ones(n,1)*std(A));

3 Commenti

Ashley
Ashley il 17 Mar 2014
I apologize, I meant to ask:
For a 3x3 matrix in Matlab, how would I find this?
= (x̄ - μ)row 1 + (x̄ - μ)row 2 + (x̄ - μ)row 3
Mischa Kim
Mischa Kim il 17 Mar 2014
Modificato: Mischa Kim il 17 Mar 2014
This also works for a 3-by-3, of course:
A = rand(3,3);
n = size(A,1);
zScoreA = (A - ones(n,1)*mean(A))./(ones(n,1)*std(A))
With MATLAB you don't need to do it row by row or column by column. You can do it for the entire matrix at once. Is this what you mean?
Ashley
Ashley il 17 Mar 2014
Yes! Thank you so much

Accedi per commentare.

Più risposte (0)

Categorie

Richiesto:

il 17 Mar 2014

Commentato:

il 17 Mar 2014

Community Treasure Hunt

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

Start Hunting!

Translated by