Solving a system of differential equations, one second order and one first order equation

4 views (last 30 days)
Angie on 7 Nov 2021
Commented: Angie on 7 Nov 2021
Hello,
I am trying to solve a system of differential equation, but one of them is first order, and the other secod order:
% d2x = -x -(sigma_0*z+sigma_1*exp(-(dx/v_d)^2)*dz+sigma_2*dx);
% dz = dx-sigma_0*abs(dx)*z/(f_c+(f_s-f_c)*exp(-(dx/v_s)^2));
where sigma_0, sigma_1, sigma_2, v_d, v_s, f_c,f_s are constants.
I tried to solve them using ode45, as i have done to solve 2 second order diffecrential equation before so:
y1=x, y2=dx, y3=z, y4=dz
dy1=y2, dy2=-y1 -(sigma_0*y3+sigma_1*exp(-(y2/v_d)^2)*y4+sigma_2*y2)
dy3=y4, dy4=? I dont have d2z, since its a first order diferential eq so I am not sure how to proced here or if there is another way to solve it.
Thank you!

Sam Chak on 7 Nov 2021
If the ODEs are  then they can be rewritten as .
Solving the systems of equations .
Now, you can enter ODEs as follow: .
Angie on 7 Nov 2021
Thank you for your answer! Indeed, I can replace the dz in the rhs of my first equation d2x with the expression of dz from my second equation. Then my first equation d2x will be in terms of x,dx and z only and I can write its state space representation to obtain two first order equations; dy1 = dx and dy2 = f(x,dx,z). Meanwhile dy3 = dz = g(x,dx,z).
Thanks again!

R2020b

Community Treasure Hunt

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

Start Hunting!