# how to solve four sets of ode having four variables

1 view (last 30 days)
Vincent Ike on 16 Jul 2021
Commented: Steven Lord on 17 Jul 2021
The distinction in my question is that I need to put up such code with convective terms. As a student of MATLAB I have not been able to find such answers from past questions in the manner below. All derivatives are with respect to time. The variables are p, q, r, s. The equations are:
d^2p/dt^2 + d^2r/dt^2 +d^2s/dt^2 = p + 2*q + 3*r + 4*s
d^2q/dt^2 + d^2r/dt^2 +d^2s/dt^2 = p + 2*q + 3*r + 4*s
d^2p/dt^2 + d^2q/dt^2 + d^2r/dt^2 +d^2s/dt^2 = p + 2*q + 3*r + 4*s - 5*dr/dt - 5*ds/dt
d^2p/dt^2 + d^2q/dt^2 + d^2r/dt^2 +d^2s/dt^2 = p + 2*q + 3*r + 4*s - 5*dr/dt - 5*ds/dt
Initial conditions are all zero at t =dt = 0, i.e. p(0)=q(0)=r(0)=s(0) = 0. and dp(0)/dt=dq(0)/dt=dr(0)/dt=ds(0)/dt=0
I have spent a great deal of time trying with ode45. I need help on this, thanks in advance!

Steven Lord on 16 Jul 2021
Use the "Example: Nonstiff van der Pol Equation" example on this documentation page to rewrite each of your higher order ODEs into a system of first order ODEs (potentially with a mass matrix.) Then solve that larger system.
However, if we look at your equations, I suspect you're going to get nowhere fast. All your initial conditions (both the "position" and "velocity" terms being 0 at t = 0) makes me suspect you may only have the solution where all your functions are {p, q, r, s}(t) = 0.
The fact that your third and fourth equations are the same is also slightly suspicious.
Steven Lord on 17 Jul 2021
You're welcome.

R2015a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!