MATLAB Answers

Vector normalization giving error in second iteration

1 ビュー (過去 30 日間)
Sania Gul
Sania Gul 2019 年 1 月 2 日
コメント済み: Sania Gul 2019 年 1 月 4 日
In first iteration, there was no issue, but in second iteration, the program stopped running giving error " Subscript indices must either be real positive integers or logicals" .
See line 62
Matlab command

  0 件のコメント



Jan 2019 年 1 月 2 日
編集済み: Jan 2019 年 1 月 2 日
You have redefined "norm" as a variable in:
norm = 1./eta;
Afterwards you cannot access the function norm() directly anymore. The solution is easy: Do not shadow built-in functiony by variables, but choose a different name for teh variable.
By the way: you can find the reason of such problems easily using the debugger. Type this in the command window:
dbstop if error
and run your code again. When Matlab stops at the problem, check the used expressions:
which norm -all % <- this will reveal the problem
size(s1) % <- might be useful in other cases

  1 件のコメント

Sania Gul
Sania Gul 2019 年 1 月 4 日
thank u thank u thank u. I highly acknowledge ur support


その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by