MATLAB Files
Trap.m This program integrates cos(x) from x = a to x = b. The program prompts the user to input the bounds of integration (a and b) and the number of subintervals for the numerical method. It performs the integration analytically and with the trapezoid rule and compares the results. Make sure to save this file in a directory where MATLAB can find it. If you need help, let me know. Once you open MATLAB, click on file, open, and find this file. It will open a separate window in which you can edit this program. To run the program you can either click on the down arrow located in the upper right corner of the second window (this saves and runs the program). Or if you have the file in a place where MATLAB can find it, you can type Trap.m at the prompt of the original window.
PlotExpTaylorError.m This program file plots the exponential function and its linear, quadratic and cubic Taylor polynomials on the top graph of a figure. It also plots the associated errors in the bottom graph of the figure. It is mostly an illustration of some of graphing capabilities of MATLAB.
NewtonIt.m This is an example of a function file. Function files are programs which can be called with an argument (or arguments) and generally return a value or values. This one takes a value of x and returns the next Newton iterate.
fractal.m This is the program I demonstrated in the class on Newton's method for higher dimensions. It basically tracks the progress of an initial guess, one step at a time, in the Newton iteration process until it finds a root. It then colors the initial guess accordingly. It may help you in your own fractal generating program. Though it is not currently designed to generate the entire fractal.
DoubleRootOrderOne.m This is the program which answers number 5(b) from homework number 2. It DEMONSTRATES that Newton's method converges to a double root linearly.
RunSimpson.m This program will run the adaptive Simpson's method program Simpson.m that you must write for Homework 6.