Solve a non linear differential equation

Hello,
I have an equation like: Az"+Bz'+Cz'sin(Dz+E)+Fz=G with A,B,C,D,E,F,G are constant, and initial conditions known.
I have to solve it using Matlab, but I really don't know how to do, even after looking for information on Internet, could you help me or tell me what function I have to use?
Thank you in advance,
Romain CHAUDET

 Respuesta aceptada

Star Strider
Star Strider el 16 de Jul. de 2015
You can find the technique of creating a companion matrix from a differential equation in most differential equation textbooks, so I will spare you the discussion here.
[A,B,C,D,E,F,G] = deal(3,5,7,11,13,17,19);
odez = @(t,z) [z(2); (-B.*z(2)-C.*z(2).*sin(D*z(1)+E)-F.*z(1)+G)./A];
ts = linspace(1, 10, 250);
[t,z] = ode45(odez, ts, [0; 0]);
figure(1)
plot(t, z)
grid
legend('z(t)', 'z’(t)')

2 comentarios

Romain Chaudet
Romain Chaudet el 16 de Jul. de 2015
Thank you very much for your help, this worked well!
Romain CHAUDET
Star Strider
Star Strider el 16 de Jul. de 2015
My pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Preguntada:

el 16 de Jul. de 2015

Comentada:

el 16 de Jul. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by