フィルターのクリア

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

2 ビュー (過去 30 日間)
eng ahmed
eng ahmed 2024 年 5 月 11 日
回答済み: Paul 2024 年 5 月 11 日
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

回答 (1 件)

Paul
Paul 2024 年 5 月 11 日
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?

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

タグ

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by