Related to Frobenius norm
Afficher commentaires plus anciens
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.
Réponses (1)
From the documentation:
7 commentaires
chaaru datta
le 22 Oct 2023
rng("default")
X = rand(3);
n = arrayfun(@(i)norm(X(:,i),"fro"),1:size(X,2))
n = vecnorm(X,2)
Dyuman Joshi
le 22 Oct 2023
Modifié(e) : Dyuman Joshi
le 22 Oct 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
le 22 Oct 2023
"abs" seems to be superfluous.
Dyuman Joshi
le 22 Oct 2023
Modifié(e) : Dyuman Joshi
le 22 Oct 2023
It might be, but that's how Wikipedia and Wolfram Alpha define it.
Idk why though.
Dyuman Joshi
le 22 Oct 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.
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!