how to normalize a matrix?????

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

Respuestas (3)

James Tursa
James Tursa el 22 de Oct. de 2014
Editada: James Tursa el 22 de Oct. de 2014

2 votos

Assuming values are positive, e.g.,
M = your matrix
N = bsxfun(@rdivide,M,max(M)); % Normalized (scaled) matrix by column
Greg Heath
Greg Heath el 23 de Oct. de 2014

2 votos

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 comentario

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

Iniciar sesión para comentar.

Steven Lord
Steven Lord el 22 de Feb. de 2021

1 voto

Use the normalize function with a dim input and the 'range' normalization method.

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 22 de Oct. de 2014

Respondida:

el 22 de Feb. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by