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 comentarios

Stephen23
Stephen23 el 21 de Sept. de 2017
Editada: Stephen23 el 21 de Sept. de 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.
Murari Kanumoori
Murari Kanumoori el 21 de Sept. de 2017
thankyou.. i changed it from in line to anonymous

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 21 de Sept. de 2017

0 votos

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

2 comentarios

Murari Kanumoori
Murari Kanumoori el 21 de Sept. de 2017
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Function Creation en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 21 de Sept. de 2017

Comentada:

el 21 de Sept. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by