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?
1 个评论
Star Strider
2012-10-21
What do you mean by magnitude?
By definition, a vector has only one dimension.
采纳的回答
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.
0 个评论
更多回答(1 个)
Azzi Abdelmalek
2012-10-21
v=[2 3 4 5]
ampv=sqrt(v.^2)
1 个评论
pratyusha adiraju
2016-9-6
编辑:pratyusha adiraju
2016-9-6
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))
另请参阅
类别
在 Help Center 和 File 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!