How can i fix this ode45 error: Not enough input arguments.
Afficher commentaires plus anciens
Hi,
I have two odes and use ode45 to solve them simultaneously. At first ode, there are two state variables: x1 and x2, but second ode has only x1. So, two initial conditions should be used for first. Additionaly, we can use one initial condition for second ode.
I have created my codes according to these rules, but i take an error from MATLAB as you can see at the title.
Is there any way to remove this error?
Thanks a lot!
clear all
clc
syms x1 x2
x1_dot = (6*atan((53*x1)/9))/(25*pi) - 40*x1 + (6*atan((179*x2)/18))/(25*pi)
x2_dot = (6*atan((53*x1)/9))/(25*pi) - 40*x1 + (6*atan((179*x1)/18))/(25*pi)
x1_dot_num=matlabFunction(x1_dot, 'Vars', {'t', 'x1','x2'});
x2_dot_num=matlabFunction(x2_dot, 'Vars', {'t', 'x1','x2'});
x1_0 = 4;
x2_0 = 5
tspan = [0 3];
[t,x1_dot_sol] = ode45(x1_dot_num,tspan,[x1_0 x2_0]);
[t,x2_dot_sol] = ode45(x2_dot_num,tspan,x1_0);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!