フィルターのクリア

Error in equation/variables

1 回表示 (過去 30 日間)
Afnan Mussa
Afnan Mussa 2021 年 4 月 2 日
コメント済み: Image Analyst 2021 年 4 月 3 日
I'm facing a small problem in MATLAB, this code I wrote is not running due to an error in line 11 (the first equation in the image attached below).
I am not sure if i should write a0 in global or not, a0 is constant and equals 1.
How can I fix this error?
here is the code
and these are the errors
  1 件のコメント
Afnan Mussa
Afnan Mussa 2021 年 4 月 2 日
Thank you all.
I am still having an error in teh dispaly figure line

サインインしてコメントする。

回答 (3 件)

Image Analyst
Image Analyst 2021 年 4 月 2 日
Theta is a vector so you need to decide if you want to do Theta(1)^2, Theta(2)^2 or Theta.^2 (using a dot).
  3 件のコメント
Afnan Mussa
Afnan Mussa 2021 年 4 月 2 日
I got it. Thank you.
Image Analyst
Image Analyst 2021 年 4 月 3 日
And next time, if you post actual code rather than an image of it, we can fix it for you.

サインインしてコメントする。


Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 4 月 2 日
% You need to perform elementwise operation. Since Theta = [0, 120]
Theta^2 % must be
Theta.^2
. % missing before / operator
Good luck
  1 件のコメント
Afnan Mussa
Afnan Mussa 2021 年 4 月 2 日
Thank you.

サインインしてコメントする。


Jacob Forbes
Jacob Forbes 2021 年 4 月 2 日
Writing a0 into global shouldn't be your issue as you said it is a constant and you have it defined as 1. From what I see, the problem you're running into is you are trying to take the square of a vector (Theta) which cannot be done unless it is done element by element, in which case you would use the operator ".^2" after (Theta) instead of "(Theta)^2" like you currently have written.
  1 件のコメント
Afnan Mussa
Afnan Mussa 2021 年 4 月 2 日
Thank you.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by