Filter löschen
Filter löschen

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

7 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Jarrod Rivituso
Jarrod Rivituso am 18 Apr. 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 Kommentare
Shravan Chandrasekaran
Shravan Chandrasekaran am 20 Apr. 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 am 20 Apr. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by