|
5.6
Oct 9, 2015 3:06:44 GMT
Post by matthorr on Oct 9, 2015 3:06:44 GMT
Here are the answers I have. Write-up to follow:
Amplitudes at end of study:
RK4: 1.000002
RK3: 1.000526
RK2: 0.999531
Phase error (deg) at end of study:
RK4: 7.689044
RK3: -0.001812
RK2: -0.71566
I'm not so sure they are correct - I would expect RK2 to also be unstable and the phase error for RK4 is very high.
|
|
|
5.6
Oct 12, 2015 22:42:45 GMT
Post by matthorr on Oct 12, 2015 22:42:45 GMT
Let \( \lambda = i\omega \)
For RK4: \[\sigma = 1+\lambda h+\frac{1}{2}\lambda^2h^2+\frac{1}{6}\lambda^3h^3+ \frac{1}{24}\lambda^4h^4 \] \[\sigma = 1+i\omega h-\frac{1}{2}(\omega^2h^2)-i\frac{1}{6}(\omega^3h^3)+ \frac{1}{24}(\omega^4h^h) \] \[\sigma_r = 1-\frac{1}{2}(\omega^2h^2)+\frac{1}{24}(\omega^4h^4) \quad\quad \sigma_i = i\omega h-i\frac{1}{6}(\omega^3h^3) \] The global error is the difference between the ODE and O\( \Delta \)E solution at time \( T=Nh \) \[ Er_\lambda = e^{\lambda Nh} -\big(\sigma(\lambda h)\big)^N \] the amplitude error \[Er_a = 1-\left(\sqrt{\sigma_r^2+\sigma_i^2}\right)^N \] \[\sigma_r^2 = 1-(\omega h)^2+\frac{1}{3}(\omega h)^4-\frac{1}{24}(\omega h)^6 +\frac{1}{576}(\omega h)^8 \] \[ \sigma_i^2 = (\omega h)^2 -\frac{1}{3}(\omega h)^4+\frac{1}{36}(\omega h)^6 \] \[Er_a = 1-\left(\frac{1}{24}\sqrt{(\omega h)^8 - 8(\omega h)^6 + 576}\right)^N \] and the phase error (in degrees) \[Er_\omega = N\frac{180}{\pi}\Bigg(\omega h-\tan^{-1}\left(\frac{\sigma_i}{\sigma_r}\right)\Bigg) \] \[Er_\omega = N\frac{180}{\pi}\Bigg(\omega h-\tan^{-1}\left(\frac{24\omega h -4(\omega h)^3}{(\omega h)^4-12(\omega h)^2 + 24}\right)\Bigg) \] The errors at \( N = 300 \) and \( \omega h = 0.10 \) are \begin{align*} \text{Amplitude: }& 1 + Er_a = 1.000002 \\ \text{Phase: }& 0.001427 deg \end{align*}
For RK3: \[\sigma = 1+\lambda h+\frac{1}{2}\lambda^2h^2+\frac{1}{6}\lambda^3h^3 \] \[ \sigma_r = 1-\frac{1}{2}(\omega h)^2 \quad\quad \sigma_i=\omega h-\frac{1}{6}(\omega h^6) \] \[ Er_a = 1-\Big(\frac{1}{6}\sqrt{(\omega h)^6-3(\omega h)^4+36} \Big)^N\] \[Er_\omega=N\frac{180}{\pi}\Bigg(\omega h-\tan^{-1}\left(\frac{6\omega h-(\omega h)^3}{6-3(\omega h)^2}\right) \Bigg) \] The errors at \( N=400 \) and \( \omega h=0.075 \) are \begin{align*} \text{Amplitude: }& 1 + Er_a = 1.000526 \\ \text{Phase: }& -0.0018124 deg \end{align*}
For RK2: \[\sigma = 1+\lambda h+\frac{1}{2}\lambda^2h^2 \] \[ \sigma_r = 1-\frac{1}{2}(\omega h)^2 \quad\quad \sigma_i=\omega h \] \[ Er_a = 1-\Big(\frac{1}{2}\sqrt{(4+(\omega h)^4} \Big)^N\] \[Er_\omega=N\frac{180}{\pi}\Bigg(\omega h-\tan^{-1}\left(\frac{2\omega h}{2-(\omega h)^2}\right) \Bigg) \] The errors at \( N=600 \) and \( \omega h=0.05 \) are \begin{align*} \text{Amplitude: }& 1 + Er_a = 0.999531 \\ \text{Phase: }& -0.71566 deg \end{align*}
|
|
|
5.6
Oct 13, 2015 1:02:46 GMT
Post by domdegs on Oct 13, 2015 1:02:46 GMT
On the RK4 method I am getting a phase error of 0.00143 degrees.
This is what I put for the calculation in matlab:
phaserk4 = Nrk4*(180/pi)*(whrk4 - atan(imagrk4/realrk4))
|
|
|
5.6
Oct 13, 2015 1:12:08 GMT
Post by lucasp on Oct 13, 2015 1:12:08 GMT
I'm getting 0.00143 deg for RK4 as well.
|
|
|
5.6
Oct 13, 2015 1:17:31 GMT
Post by matthorr on Oct 13, 2015 1:17:31 GMT
Thanks, I found my error in my MATLAB code - I had a wh^3 instead of wh^2 in sigma_r
I also get 0.001427 degrees now.
|
|