when i want to get magnitude of vector in command window told me that index exceeds matrix dimensions. although i write true code
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
v=[1 2 3 9 6]
pp=v.^2
Rr=sum(pp)
mag=sqrt(Rr)
disp(mag)
1 commentaire
Réponses (1)
Paul
le 11 Mai 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 commentaires
Voir également
Catégories
En savoir plus sur Whos dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!