Related to Frobenius norm
이전 댓글 표시
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.
답변 (1개)
From the documentation:
댓글 수: 7
chaaru datta
2023년 10월 22일
rng("default")
X = rand(3);
n = arrayfun(@(i)norm(X(:,i),"fro"),1:size(X,2))
n = vecnorm(X,2)
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
2023년 10월 22일
"abs" seems to be superfluous.
Dyuman Joshi
2023년 10월 22일
편집: Dyuman Joshi
2023년 10월 22일
It might be, but that's how Wikipedia and Wolfram Alpha define it.
Idk why though.
Dyuman Joshi
2023년 10월 22일
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.
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!