フィルターのクリア

Why Undefined operator '==' for input arguments of type 'function_handle'

1 回表示 (過去 30 日間)
Eric Daiber
Eric Daiber 2016 年 9 月 23 日
コメント済み: Star Strider 2016 年 9 月 23 日
Why do I receive the following error every time I run? "Why Undefined operator '==' for input arguments of type 'function_handle'"
Y = @(m,y) sin(theta)*m - cos(theta)*m - Q/(2*pi)*atan((m/y))
x=[];
for y = -100:0.1:100
x=[x; fzero(@(m,y) Y,25)];
end
Thanks, Eric

採用された回答

Star Strider
Star Strider 2016 年 9 月 23 日
The fzero function solves for functions of one variable. You have two, so you would have to use fsolve or another optimisation function, and you have to address them as a vector of parameters for any of the optimisation functions to work.
I have no idea what you want to do, but this is one approach that will probably work:
Q = ...;
theta = ...;
m = ...;
Y = @(m,y) sin(theta)*m - cos(theta)*m - Q./(2*pi)*atan((m./y));
x=[];
for y = -100:0.1:100
yi = fzero(@(y) Y(m,y),25)
x=[x; yi];
end
  2 件のコメント
Eric Daiber
Eric Daiber 2016 年 9 月 23 日
So I put this into Matlab and the error showing up now is: Operands to the and && operators must be convertible to logical scalar values.
Error in fzero (line 306) elseif ~isfinite(fx) ~isreal(fx)
Error in Trial3 (line 12) yi = fzero(@(y) A(m,y),25)
What is wrong? I am new to this.
Star Strider
Star Strider 2016 年 9 月 23 日
In the code you posted, you did not state what ‘Q’, ‘theta’, and ‘m’ are, so I suspect the problem is with one of them and the result of the calculations with them in your ‘Y’ function.
Please describe a bit about what you’re doing. That would help me discover where the problems may be.
Also, to clarify:
Q./(2*pi)*atan((m./y)) is the same as atan(m./y)*Q./(2*pi)
Is that what you intend?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by