code says not enough inputs in inline function

b=2.2;
d=.4;
g=5.1;
w=6;
m=1.1;
n=2;
fsize=15;
sys=inline(' [(x(1).*(1-(x(1)/g)))-(x(1).*x(2)/((1+m*n)*(w*x(1).^2+1)+x(1))); b.*x(2)*(x(1)+n*(w*x(1).^2+1))./((1+m*n)*(w*x(1).^2+1)+x(1))-d*x(2)]');
options = odeset('RelTol' ,1e-4, 'AbsTol' ,1e-4);
[t,xa]=ode45(sys,[0 100],[.2 1.2],options);
set(gca, 'xtick', [0:2:8], 'FontSize' ,fsize);
plot (xa (: ,1), xa (:, 2));
can any one help me with the code plss Thanqq

2 件のコメント

Stephen23
Stephen23 2017 年 9 月 21 日
編集済み: Stephen23 2017 年 9 月 21 日
@Murari Kanumoori: The very first line of the inline documentation states "inline will be removed in a future release. Use Anonymous Functions instead."
Can you explain why you need to use an inline function instead of a much better anonymous function? We are not asking to be annoying, but because we want to give you the best answer we can. And in this case, using anonymous functions is much better than using inline functions.
Murari Kanumoori
Murari Kanumoori 2017 年 9 月 21 日
thankyou.. i changed it from in line to anonymous

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

 採用された回答

Walter Roberson
Walter Roberson 2017 年 9 月 21 日

0 投票

Do not use inline() unless you are stuck at MATLAB R12 or earlier. Use anonymous functions instead.

2 件のコメント

Murari Kanumoori
Murari Kanumoori 2017 年 9 月 21 日
can you help me in solving the question please
Walter Roberson
Walter Roberson 2017 年 9 月 21 日
sys = @(t,x) [(x(1).*(1-(x(1)/g)))-(x(1).*x(2)/((1+m*n)*(w*x(1).^2+1)+x(1))); b.*x(2)*(x(1)+n*(w*x(1).^2+1))./((1+m*n)*(w*x(1).^2+1)+x(1))-d*x(2)];
However, one of the values just keeps increasing, and the integration is very slow as the function tries to keep the error down.
If you switch to ode15s from ode45 then the system finishes quickly, but one of the two values goes to 10^42

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeFunction Creation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by