How can I calculate the magnitude of n-dimensional vector by Matlab's commands?

92 visualizaciones (últimos 30 días)
Is there any specific command for calculating the magnitude of n-dimensional vector?

Respuesta aceptada

Wayne King
Wayne King el 21 de Oct. de 2012
Editada: Wayne King el 21 de Oct. de 2012
I'll assume by "magnitude", you mean the norm. You can just do
norm(x)
but there are different norms with different results
x = randn(10,1);
norm(x,2)
norm(x,1)
norm(x,inf)
So you have to know which one you want. Just
norm(x)
gives the 2-norm by default.

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 21 de Oct. de 2012
v=[2 3 4 5]
ampv=sqrt(v.^2)
  1 comentario
pratyusha adiraju
pratyusha adiraju el 6 de Sept. de 2016
Editada: pratyusha adiraju el 6 de Sept. de 2016
magnitude calculation procedure is r = [x y z]
rmag = (x^2 + y^2 + z^2)^0.5
so in matlab rmag =sqrt(sum(r.^2))

Iniciar sesión para comentar.

Categorías

Más información sobre Numerical Integration and Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by