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

7 次查看(过去 30 天)
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.

采纳的回答

Jarrod Rivituso
Jarrod Rivituso 2011-4-18
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 个评论
Shravan Chandrasekaran
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 2011-4-20
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by