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 Commenti

Stephen23
Stephen23 il 21 Set 2017
Modificato: Stephen23 il 21 Set 2017
@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.
thankyou.. i changed it from in line to anonymous

Accedi per commentare.

 Risposta accettata

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

2 Commenti

can you help me in solving the question please
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

Accedi per commentare.

Più risposte (0)

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by