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

91 次查看(过去 30 天)
Is there any specific command for calculating the magnitude of n-dimensional vector?

采纳的回答

Wayne King
Wayne King 2012-10-21
编辑:Wayne King 2012-10-21
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.

更多回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2012-10-21
v=[2 3 4 5]
ampv=sqrt(v.^2)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by