Borrar filtros
Borrar filtros

when i want to get magnitude of vector in command window told me that index exceeds matrix dimensions. although i write true code

2 visualizaciones (últimos 30 días)
v=[1 2 3 9 6]
v = 1x5
1 2 3 9 6
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
pp=v.^2
pp = 1x5
1 4 9 81 36
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Rr=sum(pp)
Rr = 131
mag=sqrt(Rr)
mag = 11.4455
disp(mag)
11.4455

Respuestas (1)

Paul
Paul el 11 de Mayo de 2024
Code works here
v=[1 2 3 9 6]
v = 1x5
1 2 3 9 6
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
pp=v.^2
pp = 1x5
1 4 9 81 36
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Rr=sum(pp)
Rr = 131
mag=sqrt(Rr)
mag = 11.4455
disp(mag)
11.4455
Check
norm(v)
ans = 11.4455
Perhaps you have variable(s) named sum or sqrt or disp in your workspace?

Etiquetas

Productos


Versión

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by