when i want to get magnitude of vector in command window told me that index exceeds matrix dimensions. although i write true code
1 view (last 30 days)
Show older comments
v=[1 2 3 9 6]
pp=v.^2
Rr=sum(pp)
mag=sqrt(Rr)
disp(mag)
Answers (1)
Paul
on 11 May 2024
Code works here
v=[1 2 3 9 6]
pp=v.^2
Rr=sum(pp)
mag=sqrt(Rr)
disp(mag)
Check
norm(v)
Perhaps you have variable(s) named sum or sqrt or disp in your workspace?
0 Comments
See Also
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!