# MATLAB help, code for Frobenius norm

Hello,

I am trying to write a mtlab code to compute Frobenius norm of an mxn matrix A.

defined by
$$||A||_{F} = \sqrt{ \sum_{i=1}^m \sum_{j=1}^n a^{2}_{i,j}}$$

I have so far written this code, but it does not work, if anyone can help /guide me to the right path, would be greatly appreciated.

function w = frobeniusnorm(a,m,n)
for i =1:m
sm = 0
for j =1:n
sm = sm+A(i,j)*a^2(i,j);
end