next up previous contents
Next: Using rk4plot.m Up: Using eulplot.m Previous: Example   Contents

Higher order methods

You can use eulplot.m for methods other than the Euler method if you change eulerfcn accordingly. For instance, if you use the improved Euler method for the equation $x'=t^2+x^2$, then the iteration equation is

\begin{displaymath}
x_{n+1}=x_n+{h\over 2}(t_n^2+x_n^2)+{h\over 2}
((t_n+h)^2+(x_n+h(t_n^2+x_n^2))^2).
\end{displaymath}

Consequently, you want to have the following line in initn.m:

eulerfcn='x+h/2*(t^2+x^2)+h/2*((t+h)^2+(x+h*(t^2+x^2))^2);'



Michael Renardy
2000-05-12