Related to Frobenius norm
Mostrar comentarios más antiguos
Hello all, I am trying to find Frobenius norm of each column of 2 X 500 matrix in MATLAB but not getting it correctly.
Any help in this regard will be highly appreciated.
Respuestas (1)
From the documentation:
7 comentarios
chaaru datta
el 22 de Oct. de 2023
rng("default")
X = rand(3);
n = arrayfun(@(i)norm(X(:,i),"fro"),1:size(X,2))
n = vecnorm(X,2)
Dyuman Joshi
el 22 de Oct. de 2023
Editada: Dyuman Joshi
el 22 de Oct. de 2023
Since frobenius norm is defined as the square root of sum of the absolute squares of elements of an array, simply calculate it directly for each column -
y = rand(2,500);
sqrt(sum(abs(y).^2))
vecnorm(y,2)
Torsten
el 22 de Oct. de 2023
"abs" seems to be superfluous.
Dyuman Joshi
el 22 de Oct. de 2023
Editada: Dyuman Joshi
el 22 de Oct. de 2023
It might be, but that's how Wikipedia and Wolfram Alpha define it.
Idk why though.
Dyuman Joshi
el 22 de Oct. de 2023
That should be it.
For someone who has worked with real valued data only, it easily escapes my mind that people work with non-real valued data as well.
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!