Borrar filtros
Borrar filtros

solve a second order Differential equation with a forcing function containing multiple harmonics

7 visualizaciones (últimos 30 días)
Dear all,
I need to solve a second order ODE shm by numerical integration. It contains a forcing function with multiple harmonics of cosine function.Can anyone suggest an appropriate numerical method and how to implement it in matlab?
Regards.

Respuesta aceptada

Jarrod Rivituso
Jarrod Rivituso el 18 de Abr. de 2011
I believe you can do this with any of the ode solvers.
One thing to note is that you need to convert the second order ODE to a system of two first order ODEs and explicitly solve for the derivative terms. For instance, the equation
a*x'' + b*x' + c*x = cos(3*pi*t) + cos(4*pi*t)
would become the two equations
x(2)' = (1/a) - b*x(2) - c*x(1) + cos(3*pi*t) + cos(4*pi*t) x(1)' = x(2)
Then, you can easily write the derivative function that the ODE solvers require:
function dx = derivs(t,x)
a = 1;
b = 1;
c = 1;
dx = zeros(2,1);
dx(1) = x(2);
dx(2) = (1/a) - b*x(2) - c*x(1) + cos(3*pi*t) + cos(4*pi*t)
  4 comentarios
Shravan Chandrasekaran
Shravan Chandrasekaran el 20 de Abr. de 2011
Hi Jarrod, It was the forcing function intensity. I have a periodic response which is also multi harmonic but it keeps drifting away from time axis with increase in time. Any suggestions ?
Jarrod Rivituso
Jarrod Rivituso el 20 de Abr. de 2011
You'd have to tell me what the equation is. I'd assume it has something to do with the dynamics of the ODEs.
You could try changing the phase of the forcing functions to see if that changes anything. I've seen similar "drifts" before that had to do with that.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by