Matlab code for system of ordinary differential equations

213 Views Asked by At

I have this MATLAB code to solve system of ordinary differential equations but I got the error "Not enough input arguments."

function xprime=lorenz(t,x);
sig=10;
beta=8/3;
rho=28;
xprime=[-sig*x(1)+sig*x(2);rho*x(1)-x(2)-x(1)*x(3);-beta*x(3)+x(1)*x(2)];
end

I will be glad to get help

1

There are 1 best solutions below

0
On BEST ANSWER

Most likely culprit would be you are calling your function wrongly.

Calling

  • lorentz(1,[1,2,3])

should work.

Calling

  • loretentze([1,2,3])

would give similar error that you obtained earlier as the function signature require $2$ input arguments.

Remark: $t$ is not used in your code.