jueves, 11 de abril de 2019

solution of the second order ODE


http://fourier.eng.hmc.edu/e176/lectures/NM/node42.html

Example
Solve the famous 2nd order constant-coefficient ordinary differential equation
\begin{displaymath}
m\ddot{y}(t)+c\dot{y}(t)+k y(t)=f(t)
\end{displaymath}

with zero initial conditions $\ddot{y}(0)=\dot{y}(0)=0$. Here we assume $m=10$, $c=1$, and $k=10$, and a step input $y(t)=u(t)$. Find the numerical solution $y(t)$ from $t_0=0$ to $t_{final}=50$ in $N=1,000$ steps (step size $h=(t_{final}-t_0)/N$, using each of the following methods:
  • Euler's method
  • Modified Euler's method
  • Runge-Kutta 2
  • Runge-Kutta 4
The close-form solution of the second order ODE is:
\begin{displaymath}
y(t)=1-\frac{e^{-\zeta\omega_nt}}{\sqrt{1-\zeta^2}}\sin(\omega_dt+\phi)
\end{displaymath}

where
\begin{displaymath}\zeta=\frac{c}{2\sqrt{mk}},\;\;\;\;\;\;\;\;
\omega_n=\sqrt{\...
..._d=\omega_n \sqrt{1-\zeta^2},\;\;\;\;\;\;\phi=\cos^{-1}\zeta
\end{displaymath}

The results of these numerical integral methods and the ground truth closed-form solution are compared as shown below for three different step sizes: 0.5 (left), 0.05 (middle), and 0.01 (right): RungeKuttaExample.png

next up previous

No hay comentarios:

Publicar un comentario