Not enough Input Arguments ode45
Mostrar comentarios más antiguos
How can I parametrize functions and then apply ode45 to this function?
When I explicitly give all parametrs as numbers ode45 runs fine, however when I change to variables MatLab has insufficient Input Arguments.
This Runs fine:
function [dx] = NI(t,x,sigma)
rho=0.01;
sigma=0.5;
a=0.3;
c=(9*a^2*rho*sigma+sqrt(3)*sqrt(4*a^6*rho^3+27*a^4*rho^2*sigma^2))^(1/3);
zeta=c/((2*9)^(1/3)*a)-(2/3)^(1/3)*a*rho/c;
thau=(1+a)/(a*zeta)*(rho*sigma-a*rho*zeta-a*sigma*zeta^2/(1+a));
dx=[-sigma^2*(x(1)^3-x(1)^2)+(rho+thau)*x(1)-rho-rho*x(2);(zeta^2-sigma^2*x(1)^2)*x(2)];
end
% followed in seperate script by
Time=[0,200];
x0=[0,0];
sigma=0.5;
[t,x]=ode45(@NI,Time,x0,sigma);
plot(x)
This gives the error:
function [dx] = NI(t,x,sigma)
rho=0.01;
a=0.3;
c=(9*a^2*rho*sigma+sqrt(3)*sqrt(4*a^6*rho^3+27*a^4*rho^2*sigma^2))^(1/3);
zeta=c/((2*9)^(1/3)*a)-(2/3)^(1/3)*a*rho/c;
thau=(1+a)/(a*zeta)*(rho*sigma-a*rho*zeta-a*sigma*zeta^2/(1+a));
dx=[-sigma^2*(x(1)^3-x(1)^2)+(rho+thau)*x(1)-rho-rho*x(2);(zeta^2-sigma^2*x(1)^2)*x(2)];
end
% followed in seperate script by
Time=[0,200];
x0=[0,0];
sigma=0.5;
[t,x]=ode45(@NI,Time,x0,sigma);
plot(x)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!