Hi everybody, I am trying to solve set of three non linear equations using fsolve. However, I am getting "Not enough input arguments" error. Following is my function ( curv_)
function F = curv_(x)
K = 1;
T = 5;
theta = 1;
lambda = 1.7;
ns = .01i;
w = ns/1i;
G = K*(exp(-theta*(ns)))/(T*ns+1);
root =(-1/lambda);
Mdy = ns*(exp(-(theta*ns)))/((lambda*ns+1)^2)/x(3);
g = exp(-theta*(root))/(T*root+1);
X=-(1/(g));
A=1/(Mdy);
B=1/(G);
F(1) = x(1) + x(2)*w^(-x(3))*cos(x(3)*pi/2) - real(A) + real(B);
F(2) = -x(2)*w^(-x(3))*sin(x(3)*pi/2) - imag(A) + imag(B);
F(3) = x(1) + x(2)*(-lambda)^x(3) - X;
end
The codes, I am trying to run are as follows.
fun=@curv_;
x0=[1.2 1.2 .3];
x = fsolve(curv_,x0)

 採用された回答

Stephen23
Stephen23 2017 年 11 月 14 日
編集済み: Stephen23 2017 年 11 月 14 日

0 投票

You either need
x = fsolve(@curv_,x0)
or
x = fsolve(fun,x0)
Why? Because your code calls the function, rather then passing a function handle to fsolve.

2 件のコメント

Dhiraj R
Dhiraj R 2017 年 11 月 14 日
That was silly mistake. Can you point out, why am I getting output as complex number?
Stephen23
Stephen23 2017 年 11 月 14 日
編集済み: Stephen23 2017 年 11 月 14 日
@Dhiraj R: that is quite a complex function, with many trig functions and imag and roots and powers... complex output does not sound unfeasible. If you are sure that a complex output for that function is impossible, then you need to debug it.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Mathematics についてさらに検索

製品

質問済み:

2017 年 11 月 14 日

編集済み:

2017 年 11 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by