MATLAB Answers

0

how to normalize a matrix?????

Asked by abdulkader helwan on 22 Oct 2014
Latest activity Commented on by Image Analyst
on 25 Oct 2014
hello everyone... i need a code to normalize( between 0 and 1) a matrix 7*50. the normalization process should be for each column not row**. in other words, the program should seek for the largest value in each column and divide all the elements in that column by it. can anybody help plzz

  0 Comments

Sign in to comment.

Tags

No tags entered yet.

2 Answers

Answer by James Tursa
on 22 Oct 2014
Edited by James Tursa
on 22 Oct 2014

Assuming values are positive, e.g.,
M = your matrix
N = bsxfun(@rdivide,M,max(M)); % Normalized (scaled) matrix by column

  0 Comments

Sign in to comment.


Greg Heath
Answer by Greg Heath
on 23 Oct 2014

rng('default')
A = 100*randn(3)
Amin = repmat(min(A),3,1)
Amax = repmat(max(A),3,1)
a = (A-Amin)./(Amax-Amin)
Hope this helps.
Thank you for formally accepting my answer
Greg

  1 Comment

Image Analyst
on 25 Oct 2014
abdulkader's "Answer" moved here:
thnaks bro.. that was helpful

Sign in to comment.