MATLAB: How can i solve these ODEs

differential equationsMATLABsymbolic

Hi,
I have two ODEs with 2 initial conditions. I have created code for this, but have a problem:
Why do i see X1 and X2 at the results? Results should include only t.
Thx!
clear all
clc
u=5
syms x1 x2
x1_dot=(1936*sin((3*atan((17263*u)/62500 - (10720323*x1)/156250000 + (594*atan((37881*x1)/625000 - (61*u)/250 + 427/6250))/(25*pi) - 120841/1562500))/2))/1025 - (1936*sin((3*atan((594*atan((4819*x1)/625000 - 427/6250))/(25*pi) - (1363777*x1)/156250000 + 120841/1562500))/2))/1025 - 10*x1 - 236/1025
x2_dot=(1077384*sin((3*atan((17263*u)/62500 - (10720323*x1)/156250000 + (594*atan((37881*x1)/625000 - (61*u)/250 + 427/6250))/(25*pi) - 120841/1562500))/2))/333125 - (955416*sin((3*atan((594*atan((4819*x1)/625000 - 427/6250))/(25*pi) - (1363777*x1)/156250000 + 120841/1562500))/2))/333125 - 4956/13325
syms x1_dot_sol(t) x2_dot_sol(t)
ode1=diff(x1_dot_sol)==x1_dot;
ode2=diff(x2_dot_sol)==x2_dot;
odes=[ode1; ode2]
cond1=x1_dot_sol(0)==10;
cond2=x2_dot_sol(0)==10
conds=[cond1; cond2]
[x1_dot_result x2_dot_result]=dsolve(odes,conds)

Best Answer

This is correct code for your ODEs
clc
syms x1(t) x2(t) u
x1_dot = diff(x1, t);
x2_dot = diff(x2, t);
ode1 = x1_dot == (1936*sin((3*atan((17263*u)/62500 - (10720323*x1)/156250000 + (594*atan((37881*x1)/625000 - (61*u)/250 + 427/6250))/(25*pi) - 120841/1562500))/2))/1025 - (1936*sin((3*atan((594*atan((4819*x1)/625000 - 427/6250))/(25*pi) - (1363777*x1)/156250000 + 120841/1562500))/2))/1025 - 10*x1 - 236/1025;
ode2 = x2_dot ==(1077384*sin((3*atan((17263*u)/62500 - (10720323*x1)/156250000 + (594*atan((37881*x1)/625000 - (61*u)/250 + 427/6250))/(25*pi) - 120841/1562500))/2))/333125 - (955416*sin((3*atan((594*atan((4819*x1)/625000 - 427/6250))/(25*pi) - (1363777*x1)/156250000 + 120841/1562500))/2))/333125 - 4956/13325;
odes=[ode1; ode2];
cond1=x1_dot(0)==10;
cond2=x2_dot(0)==10;
conds=[cond1; cond2];
[x1_dot_result, x2_dot_result] = dsolve(odes,conds)
However, MATLAB is unable to find a symbolic solution. The equation seems quite nonlinear and complex, and it is unlikely at an analytical solution exist. You can find a numerical solution using ode45().