Next: Higher order methods Up: Using eulplot.m Previous: Using eulplot.m   Contents

### Example

When you first copy the above files, they should be set to run the following example.
Use Euler's method to approximate a solution to the ODE . By hand, set up the iterating equation and solve for three iterations using the initial condition and step size . Next investigate graphically using eulplot with the four step sizes . Identify each plot with its respective step size. Explain the rather odd behavior for with when all plots are compared. You may need to calculate a few Euler iterations by hand for these step sizes. (Does this suggest more than one way that step size can affect results?)
1. Iterating equation with

2. Change only the following in initn.m

ftx='2*t*x';
eulerfcn='x+h*(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).
3. Type eulplot to get

4. For , we have

Each subsequent iteration will also be zero.
For , we have

Each subsequent iteration will also be zero.

Next: Higher order methods Up: Using eulplot.m Previous: Using eulplot.m   Contents
Michael Renardy
2000-05-12