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?

 Accepted Answer

Mischa Kim
Mischa Kim on 17 Mar 2014
Edited: Mischa Kim on 17 Mar 2014
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 Comments

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 on 17 Mar 2014
Edited: Mischa Kim on 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 on 17 Mar 2014
Yes! Thank you so much

Sign in to comment.

More Answers (0)

Categories

Asked:

on 17 Mar 2014

Commented:

on 17 Mar 2014

Community Treasure Hunt

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

Start Hunting!