Hello, when I am trying to solve my equations using dsolve, I get an empty sym for my dsolve.
1 view (last 30 days)
Show older comments
The above is the equations I used to do my diferentiation wrt different states to get the hamiltonian equations for dsolve and attached is my code below. It is quite long and messy but all the variables are x1-x7, lam1-lam7 with the initial and final conditions as required for the dsolve.
epsilon = 0
clear all
S = dsolve(['Dx1 = x3 + (9476649*lam3*x2)/(81350000*lam2) + (8379*lam1)/(80*lam2*x5) + (g*cos(x1 - x4))/x2 - ((8379*x2^2*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/800 + sin(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400))/(x2*x5) + (8379*lam2*x2^2*((10*((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/(lam2*x2) + ((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))/(2*lam2*x2)))/(800*x5), '...
'Dx2 = (cos(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400) - (8379*x2^2*(((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + 3/100))/800)/x5 + g*sin(x1 - x4) + (728973*lam3*x2^2*((5200*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(71*lam2) - (4160000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2^2*x2^2)))/162700000 + (8379*lam2*x2^2*(((100*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(71*lam2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2^2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + ((2000*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(71*lam2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2^2*x2^2))*((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))))/(800*x5) + (8379*lam1*x2*((2000*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(71*lam2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2^2*x2^2)))/(800*x5), '...
'Dx3 = (9476649*lam1*x2)/(81350000*lam2) - (728973*x2^2*((683*x1)/1000 + (21663*x3)/(2500*x2) - (4160000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - 1/20))/162700000 + (10718090019*lam3*x2^2*x5)/(82722781250000*lam2) + (8379*lam2*x2^2*((2262*x5*((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/(203375*lam2) + (1131*x5*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/(2033750*lam2)))/(800*x5), '...
'Dx4 = x3, '...
'Dx5 = - (5*x2)/153117 - (x6*((100*x2)/17013 - 11))/6000000 - 7/90, '...
'Dx6 = -x2*sin(x1 - x4), '...
'Dx7 = x2*cos(x1 - x4), '...
'Dlam1 = lam1*((g*sin(x1 - x4))/x2 + (cos(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400))/(x2*x5)) - (11708035353*lam3*x2^2)/162700000000 - lam2*(g*cos(x1 - x4) - (sin(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400))/x5) + lam6*x2*cos(x1 - x4) + lam7*x2*sin(x1 - x4), '...
'Dlam2 = lam5*(x6/1020780000 + 5/153117) + lam1*((sin(epsilon + x1)*(x6/56710 + 10000/17013) - (8379*x2^2*((1653*x3)/(500*x2^2) - (3200000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^3) + (1600000*x5*((672842079*lam3*x2)/81350000000 + (594909*lam1)/(160000*x5) - (983384577*lam2*x3)/(800000000*x5) + (8379*lam2*x2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(400*x5)))/(594909*lam2*x2^2)))/800 + (8379*x2*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/400)/(x2*x5) + (g*cos(x1 - x4))/x2^2 - ((8379*x2^2*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/800 + sin(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400))/(x2^2*x5)) - lam7*cos(x1 - x4) + lam6*sin(x1 - x4) - (728973*lam3*x2^2*((21663*x3)/(2500*x2^2) - (8320000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^3) + (4160000*x5*((672842079*lam3*x2)/81350000000 + (594909*lam1)/(160000*x5) - (983384577*lam2*x3)/(800000000*x5) + (8379*lam2*x2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(400*x5)))/(594909*lam2*x2^2)))/162700000 + (728973*lam3*x2*((683*x1)/1000 + (21663*x3)/(2500*x2) - (4160000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - 1/20))/81350000 - (lam2*((8379*x2^2*(((1653*x3)/(10000*x2^2) - (160000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^3) + (80000*x5*((672842079*lam3*x2)/81350000000 + (594909*lam1)/(160000*x5) - (983384577*lam2*x3)/(800000000*x5) + (8379*lam2*x2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(400*x5)))/(594909*lam2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + ((1653*x3)/(500*x2^2) - (3200000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^3) + (1600000*x5*((672842079*lam3*x2)/81350000000 + (594909*lam1)/(160000*x5) - (983384577*lam2*x3)/(800000000*x5) + (8379*lam2*x2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(400*x5)))/(594909*lam2*x2^2))*((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))))/800 + cos(epsilon + x1)*(x6/56710 + 10000/17013) - (8379*x2*(((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + 3/100))/400))/x5, '...
'Dlam3 = (63420651*lam3*x2)/203375000000 - lam4 - lam1, '...
'Dlam4 = g*lam2*cos(x1 - x4) - lam6*x2*cos(x1 - x4) - lam7*x2*sin(x1 - x4) - (g*lam1*sin(x1 - x4))/x2, '...
'Dlam5 = lam2*((cos(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400) - (8379*x2^2*(((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + 3/100))/800)/x5^2 - (8379*x2^2*(((80000*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - (80000*x5*((594909*lam1*x2)/(160000*x5^2) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5^2)))/(594909*lam2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + ((1600000*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - (1600000*x5*((594909*lam1*x2)/(160000*x5^2) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5^2)))/(594909*lam2*x2^2))*((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))))/(800*x5)) - lam1*(((8379*x2^2*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/800 + sin(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400))/(x2*x5^2) + (8379*x2*((1600000*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - (1600000*x5*((594909*lam1*x2)/(160000*x5^2) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5^2)))/(594909*lam2*x2^2)))/(800*x5)) - (728973*lam3*x2^2*((4160000*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - (4160000*x5*((594909*lam1*x2)/(160000*x5^2) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5^2)))/(594909*lam2*x2^2)))/162700000, '...
'Dlam6 = lam5*(x2/1020780000 - 11/6000000) - (lam2*cos(epsilon + x1)*(x2/56710 - 33/1000))/x5 + (lam1*sin(epsilon + x1)*(x2/56710 - 33/1000))/(x2*x5), '...
'Dlam7 = 0, '...
'x1(0) = 0.043891433584247, '...
'x2(0) = 63.291751932577750, '...
'x3(0) = 0 , '...
'x4(0) = 0.043891433584247, '...
'x5(0) = 1248.5, '...
'x6(0) = 0, '...
'x7(0) = 0, '...
'x1(tf) = 0.315320021418749,'...
'x2(tf) = 24.042387774762076,'...
'x3(tf) = 0,'...
'x4(tf) = 0.315320021418749,'...
'lam5(tf) = 0,'...
'x6(tf) = 88.638161212179780,'...
'lam7(tf) = 0'])
t = 'tf'
0 Comments
Answers (1)
Walter Roberson
on 11 Feb 2022
Edited: Walter Roberson
on 11 Feb 2022
MATLAB is never able to handle more than one boundary condition on the same function. In cases where it is possible to solve at all, you must specify at most one boundary condition for the functions, and then do a post-processing step to solve the boundaries.
MATLAB generates solutions by solving the highest level of derivative for a function and adding a constant; integrating that and adding a constant to the result; integrating that and adding a constant, and so on, so ending up with something of the form F(t) = f(t) + constant0 + constant1 * t + constant2 * t^2 + ... and the boundary conditions serve only to constrain the one constant that is added per level. There is no provision in the code to take multiple boundary conditions as hints to generate a periodic function that goes through all the points, or anything like that. It is all straight single-point-per-derivative constraints.
When you have so many variables, most of the time MATLAB will not be able to find a closed form solution. Sometimes software systems are able to find representable solutions, but only when no boundary conditions are given (the boundary conditions are too hard to solve, such as if they involve polynomials of degree 5 or higher.) So sometimes you need to solve without boundary conditions and then introduce some of the boundary conditions. But in the case of this system, MATLAB is not able to find a solution even for the basic equations without boundary conditions. There isn't much that can be done in such a case, at least not without a lot of hand effort.
syms x1(t) x2(t) x3(t) x4(t) x5(t) x6(t) x7(t)
syms lam1(t) lam2(t) lam3(t) lam4(t) lam5(t) lam6(t) lam7(t)
syms tf g epsilon
Dx1 = diff(x1); Dx2 = diff(x2); Dx3 = diff(x3); Dx4 = diff(x4); Dx5 = diff(x5); Dx6 = diff(x6); Dx7 = diff(x7);
Dlam1 = diff(lam1); Dlam2 = diff(lam2); Dlam3 = diff(lam3); Dlam4 = diff(lam4);
Dlam5 = diff(lam5); Dlam6 = diff(lam6); Dlam7 = diff(lam7);
eqns = [
Dx1 == x3 + (9476649*lam3*x2)/(81350000*lam2) + (8379*lam1)/(80*lam2*x5) + (g*cos(x1 - x4))/x2 - ((8379*x2^2*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/800 + sin(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400))/(x2*x5) + (8379*lam2*x2^2*((10*((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/(lam2*x2) + ((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))/(2*lam2*x2)))/(800*x5)
Dx2 == (cos(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400) - (8379*x2^2*(((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + 3/100))/800)/x5 + g*sin(x1 - x4) + (728973*lam3*x2^2*((5200*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(71*lam2) - (4160000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2^2*x2^2)))/162700000 + (8379*lam2*x2^2*(((100*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(71*lam2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2^2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + ((2000*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(71*lam2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2^2*x2^2))*((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))))/(800*x5) + (8379*lam1*x2*((2000*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(71*lam2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2^2*x2^2)))/(800*x5)
Dx3 == (9476649*lam1*x2)/(81350000*lam2) - (728973*x2^2*((683*x1)/1000 + (21663*x3)/(2500*x2) - (4160000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - 1/20))/162700000 + (10718090019*lam3*x2^2*x5)/(82722781250000*lam2) + (8379*lam2*x2^2*((2262*x5*((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/(203375*lam2) + (1131*x5*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/(2033750*lam2)))/(800*x5)
Dx4 == x3
Dx5 == - (5*x2)/153117 - (x6*((100*x2)/17013 - 11))/6000000 - 7/90
Dx6 == -x2*sin(x1 - x4)
Dx7 == x2*cos(x1 - x4)
Dlam1 == lam1*((g*sin(x1 - x4))/x2 + (cos(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400))/(x2*x5)) - (11708035353*lam3*x2^2)/162700000000 - lam2*(g*cos(x1 - x4) - (sin(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400))/x5) + lam6*x2*cos(x1 - x4) + lam7*x2*sin(x1 - x4)
Dlam2 == lam5*(x6/1020780000 + 5/153117) + lam1*((sin(epsilon + x1)*(x6/56710 + 10000/17013) - (8379*x2^2*((1653*x3)/(500*x2^2) - (3200000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^3) + (1600000*x5*((672842079*lam3*x2)/81350000000 + (594909*lam1)/(160000*x5) - (983384577*lam2*x3)/(800000000*x5) + (8379*lam2*x2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(400*x5)))/(594909*lam2*x2^2)))/800 + (8379*x2*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/400)/(x2*x5) + (g*cos(x1 - x4))/x2^2 - ((8379*x2^2*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/800 + sin(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400))/(x2^2*x5)) - lam7*cos(x1 - x4) + lam6*sin(x1 - x4) - (728973*lam3*x2^2*((21663*x3)/(2500*x2^2) - (8320000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^3) + (4160000*x5*((672842079*lam3*x2)/81350000000 + (594909*lam1)/(160000*x5) - (983384577*lam2*x3)/(800000000*x5) + (8379*lam2*x2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(400*x5)))/(594909*lam2*x2^2)))/162700000 + (728973*lam3*x2*((683*x1)/1000 + (21663*x3)/(2500*x2) - (4160000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - 1/20))/81350000 - (lam2*((8379*x2^2*(((1653*x3)/(10000*x2^2) - (160000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^3) + (80000*x5*((672842079*lam3*x2)/81350000000 + (594909*lam1)/(160000*x5) - (983384577*lam2*x3)/(800000000*x5) + (8379*lam2*x2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(400*x5)))/(594909*lam2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + ((1653*x3)/(500*x2^2) - (3200000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^3) + (1600000*x5*((672842079*lam3*x2)/81350000000 + (594909*lam1)/(160000*x5) - (983384577*lam2*x3)/(800000000*x5) + (8379*lam2*x2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(400*x5)))/(594909*lam2*x2^2))*((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))))/800 + cos(epsilon + x1)*(x6/56710 + 10000/17013) - (8379*x2*(((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + 3/100))/400))/x5
Dlam3 == (63420651*lam3*x2)/203375000000 - lam4 - lam1
Dlam4 == g*lam2*cos(x1 - x4) - lam6*x2*cos(x1 - x4) - lam7*x2*sin(x1 - x4) - (g*lam1*sin(x1 - x4))/x2
Dlam5 == lam2*((cos(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400) - (8379*x2^2*(((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + 3/100))/800)/x5^2 - (8379*x2^2*(((80000*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - (80000*x5*((594909*lam1*x2)/(160000*x5^2) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5^2)))/(594909*lam2*x2^2))*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)) + ((1600000*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - (1600000*x5*((594909*lam1*x2)/(160000*x5^2) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5^2)))/(594909*lam2*x2^2))*((161*x1)/500 + (1653*x3)/(10000*x2) - (80000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2))))/(800*x5)) - lam1*(((8379*x2^2*((161*x1)/25 + (1653*x3)/(500*x2) - (1600000*x5*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2)))/800 + sin(epsilon + x1)*((10000*x2)/17013 + (3*x6*((100*x2)/17013 - 11))/1000 + 1400))/(x2*x5^2) + (8379*x2*((1600000*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - (1600000*x5*((594909*lam1*x2)/(160000*x5^2) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5^2)))/(594909*lam2*x2^2)))/(800*x5)) - (728973*lam3*x2^2*((4160000*((672842079*lam3*x2^2)/162700000000 + (594909*lam1*x2)/(160000*x5) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5)))/(594909*lam2*x2^2) - (4160000*x5*((594909*lam1*x2)/(160000*x5^2) + (8379*lam2*x2^2*((11431*x1)/50000 + (117363*x3)/(1000000*x2)))/(800*x5^2)))/(594909*lam2*x2^2)))/162700000
Dlam6 == lam5*(x2/1020780000 - 11/6000000) - (lam2*cos(epsilon + x1)*(x2/56710 - 33/1000))/x5 + (lam1*sin(epsilon + x1)*(x2/56710 - 33/1000))/(x2*x5)
Dlam7 == 0
]
ics0 = [
x1(0) == sym('0.043891433584247')
x2(0) == sym('63.291751932577750')
x3(0) == sym(0)
x4(0) == sym('0.043891433584247')
x5(0) == sym('1248.5')
x6(0) == sym(0)
x7(0) == sym(0)
]
icstf = [
x1(tf) == sym('0.315320021418749')
x2(tf) == sym('24.042387774762076')
x3(tf) == sym(0)
x4(tf) == sym('0.315320021418749')
lam5(tf) == sym(0)
x6(tf) == sym('88.638161212179780')
lam7(tf) == sym(0)
]
sol1 = dsolve(eqns)
%sol2 = dsolve([eqns; ics0])
%sol3 = dsolve([eqns; ics0; icstf])
string(eqns)
string(ics0)
string(icstf)
5 Comments
Walter Roberson
on 12 Feb 2022
Sorry, I have not studied optimal control at all.
Those look like they might rocket equations? If so then searching on the topic of optimal control rocket could potentially help.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!