Department of Mathematics

Math 300: Mathematical Computing

Matlab ICE

Recall that we can approximate the derivative of a function f at a point x using the formula
f'(x) ~ Fh = (f(x+h)-f(x-h)) / (2h).

For this exercise, you must write a function deriv_test that takes three arguments: the function f, the point where the derivative is to be approximated x, and the correct value of the derivative. Thus, the function will be called as deriv_test(f,x,correct). The function will compute the above approximation to the derivative for values of h going down in powers of ten, with exponent p, from 10-1 to 10-16. It will plot the absolute error |f'(x)-Fh|
for each of those values of p = -1, -2, ..., -16. In other words, the power p of 10 is on the horizontal axis, and the error is on the vertical axis. The function must return the vector of approximations to the derivative.

Assignment 6 is posted.

The midterm exam will take place on Friday, 12 October. As always, you are permitted any paper notes you find useful, but no electronic devices are allowed. The test is cumulative, but emphasizes the material covered in the last fours weeks. A sample exam is available.

You need to install Matlab on your computer by Wednesday. You do not need Simulink or any particular toolboxes, though you might find the Symbolic toolbox useful at some time in the future (not in this class).

Department of Mathematics, PO Box 643113, Neill Hall 103, Washington State University, Pullman WA 99164-3113, 509-335-3926, Contact Us
Copyright © 1996-2015 Kevin Cooper