solve and plot a system of nonlinear 2nd order differential equations
Afficher commentaires plus anciens
hi there,
I'm trying to plot a graph of
against
with the following equations of motion:
I've tried dsolve and ode45 yet there always seems to be some problems. I think ode45 might work better because apparently it would be easier to plot the graph by using some numerical method?
Here's my failed attempt to solve it: (I just set some variables to be 1 to make the problem easier here)
syms theta(t) phi(t) psi(t) C
dtheta = diff(theta , t);
d2theta = diff(theta , t , 2);
dphi = diff(phi , t);
%dpsi = diff(psi , t);
%alpha = C * (dpsi + dphi * cos(theta));
%beta = alpha * cos(theta) + dphi * (sin(theta))^2;
alpha = 1;
beta = 1;
dpsi = 1;
eqn1 = dphi == (beta - alpha * cos(theta)) / (sin(theta))^2 ; %equations of motion
eqn2 = d2theta == (dphi*(dphi * cos(theta) - alpha)+1)*sin(theta) ; %equations of motion
eqns = [eqn1 , eqn2];
%cond = [dpsi == 1];
[thetaSol(t) phiSol(t)] = dsolve(eqns)
Thanks a lot for your help and time in advance!
Cheers,
Jane
2 commentaires
Walter Roberson
le 26 Mar 2019
There are at least four solutions to that.
Two of them are pretty abstract, involving integrals of roots of an equation -- not closed form solutions but rather a description of what properties the solution function would have to have.
The other two solutions are closed form:
theta(t) = arctan(sqrt(2*diff(phi(t), t) - 1)/diff(phi(t), t), (-diff(phi(t), t) + 1)/diff(phi(t), t))
and the same except the negative of the first parameter.
MATLAB is not powerful enough to arrive at these solutions.
Walter Roberson
le 26 Mar 2019
Have a look at odeFunction() and in particular the first example. It shows you the functions you need to use in order to convert the symbolic forms into something you can call with ode45.
Use the options structure created by odeset to designate an OutputFcn . You might want to use @odephas2 to construct a 2D phase plot, perhaps.
Réponse acceptée
Plus de réponses (1)
Hello, I am having troubles solving a system of second order nonlinear equations with boundary conditions using MATALB
Here is the equations:
f''(t)=3*f(t)*g(t) +5;
g''(t)=-4f(t)*g(t)+7;
the boundary conditions are: f'(0)=0 et g'(o)=5;
g(0)=3 et f'(2)=f(2)
Catégories
En savoir plus sur Symbolic Math Toolbox 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!
