What is the "norm" in Matlab?

I came to the norm function in Matlab and checked its documentation, but it was not clear to me. Can you just clarify what exactly this does?

Also, when choosing inf , which, based on documents, returns a degree of infinity, "what does that mean?

+4
source share
3 answers

The norm raises each value to power, adds them, then takes the root (value-th root). You can recognize the 2nd norm from the distance between two calculation points

data: 2,3,5

 2 norm: square root(2^2 + 3^2 + 5^2) 3 norm: cube root(2^3 + 3^3 + 5^3) 4 norm: 4th root(2^4 + 3^4 + 5^4) 

etc. etc.

Interesting:

 99999 norm = 99999th root(2^99999 + 3^99999 + 5^99999) approximately equals 5 (the largest value) 

So:

 infinity norm= infinityth root(2^infinity + 3^infinity + 5^infinity)=5 

In principle, an infinite norm ends as the highest value

+13
source

Matlab provides vector and matrix norms, and the norm function calculates several different types of matrix norms. The matrix norm is a scalar, which gives some measure of the magnitude of the matrix elements. The norm function calculates several different types of matrix norms:

 n = norm(A) returns the largest singular value of A, max(svd(A)). 

Now inf is The infinity norm or largest row sum of A as max(sum(abs(A')))
Note that norm(A) , where A is the vector of n-elements, is the length of A, since you can also find the root-mean-square (RMS) value from norm(A)/sqrt(n)
Note that the norm (x) is the Euclidean length of the vector x. MATLAB, on the other hand, uses length to indicate the number of elements n in a vector. This example uses norm (x) / sqrt (n) to get the rms value (RMS) of the n-element vector x. As an example

 x = [0 1 2 3] x = 0 1 2 3 sqrt(0+1+4+9) % Euclidean length ans = 3.7417 norm(x) ans = 3.7417 n = length(x) % Number of elements n = 4 rms = 3.7417/2 % rms = norm(x)/sqrt(n) rms = 1.8708 
+3
source

norm simply calculates the norm of a vector or matrix . In most cases, you are interested in the so-called Euclidean norm, so by default MATLAB will call

 norm(X,2) == norm(X) 

If you are in a space with p dimensions, we may think that we are using a norm with higher dimensions.

Your question is more related to a purely mathematical background, so I suggest you get a good tutorial on algebra and geometry: Google can also be useful, as well as a wiki .

Hope this helps a bit.

Edit

In your case, I think I would go this way

 pdist2(Cluster,Centroid) 

which will determine the distance of each element of your Cluster from Centroid .

+1
source

All Articles