What does the function 'norm' do?
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (2)
Bruno Pop-Stefanov
el 21 de Feb. de 2014
8 votos
The second input argument of the "norm" function specifies the order of the norm you would like to use. The default norm is the 2-norm, which is the Euclidean distance.
The p-norm is the p-th root of the sum of the terms elevated to the p-th power, i.e.:

3 comentarios
Priya
el 21 de Feb. de 2014
Walter Roberson
el 21 de Feb. de 2014
No, it would be
SS_res = ∑(y-yhat)^2
There would normally be a sqrt() around the sum() but you then square the result of the norm, so that cancels out the sqrt()
Priya
el 21 de Feb. de 2014
Categorías
Más información sobre Direct Search 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!