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

Example

Use rk4plot to graphically investigate numerical solutions to the ODE $x'= 2tx$. Use the four step sizes $h = 0.5,\; 0.25,\; 0.1,\;, 0.01$. This M-file uses a 4th order Runge-Kutta scheme. Identify each plot with its respective step size.
  1. Change only the following in initn.m
     
    ftx='2*t*x'; 
    hvec=[.5,.25,.1,.01]; 
    t0=-2; tf=2; x0=1;
    
    Save, then type initn to initialize the variables (or copy-and-paste at the Emporium).
  2. Type rk4plot

    \begin{picture}(5,5.5)
\put(1,0){\includegraphics [width=5cm,height=5cm]{inst3f02.ps}}
\end{picture}


    (How does the plot for eulplot compare with that for rk4plot when $h = 0.1$? Which is more accurate for the same step size?)



Michael Renardy
2000-05-12