MATLAB: What does the function ‘norm’ do

matlab functionnorm

Please tell me what does the 2(in bold) in the below expression mean?
residsumsq = norm(y-yhat, 2 )^2;
Also, Is the norm function referring to summation? I read the documentation but it is not clear.

Best Answer

n = norm(X) returns the 2-norm of input X and is equivalent to norm(X,2). If X is a vector, this is equal to the Euclidean distance. If X is a matrix, this is equal to the largest singular value of X.
The 2-norm is equal to the Euclidean length of the vector.
So it norm(x) is norm(x,2) is sqrt(sum(x.^2))