# What does the function 'norm' do?

36 Ansichten (letzte 30 Tage)
Priya am 21 Feb. 2014
Kommentiert: Priya am 21 Feb. 2014
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.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Walter Roberson am 21 Feb. 2014
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))
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (2)

Bruno Pop-Stefanov am 21 Feb. 2014
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 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Walter Roberson am 21 Feb. 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 am 21 Feb. 2014
Ya, I understood now. Thanks very much for your help.

Melden Sie sich an, um zu kommentieren.

dpb am 21 Feb. 2014
It's the order of the norm requested, in this case the "2-norm" which is the same thing as the Euclidean norm...
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Priya am 21 Feb. 2014
Thank you.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu H-Infinity Synthesis finden Sie in Help Center und File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by