How do I code to normalize a matrix by dividing each index by the max abs value in the row

3 visualizaciones (últimos 30 días)
A = input('Enter matrix for normalization:'); [x,y] = size(A);
z=abs(C); m=0; n=0;
for i=1:x
end
disp(n)

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 11 de Sept. de 2013
Editada: Azzi Abdelmalek el 11 de Sept. de 2013
A=[2 7;8 10]
out=A/max(abs(A(:)))
  2 comentarios
Sterlin
Sterlin el 12 de Sept. de 2013
Thanks Azzi. That definitely shortened my code and I learned a new command.
Jan
Jan el 12 de Sept. de 2013
But this does not solve the question: "dividing each index by the max abs value in the row".

Iniciar sesión para comentar.

Más respuestas (1)

Jan
Jan el 12 de Sept. de 2013
A = [2 7;8 10];
m = max(abs(A), [], 2);
B = bsxfun(@rdivide, A, m);

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by