Author: Rajesh Bhaskaran, Cornell University
Problem Specification
1. Euler Integration
2. Array Pre-Allocation
3. Plotting
4. Function Creation
5. Structure Creation
Exercises
Comments
Exercise
Modify the code from the tutorial to make a plot showing the effect of the no. of time-steps n on the Euler's method solution. Use the following two values for n: 100 and 200. Make two calls to the Euler function for the two different time-steps.
Your modified plot of x vs. t should contain three curves:
- n=100 solution
- n=200 solution
- Analytical solution
Use a different line style and color for each curve. Modify the legend to suitably label the three curves. Change the axis limits as necessary. We suggest that you create a copy of the code from the tutorial and work with that.
Submit your modified code and plot.