Homework 4- Interpolation and Approximation

Written and Programming Assignment Due:
Tuesday, April 1, 2003, 11AM




1. Written problems chapter 7 Heath text. 7.1, 7.2.

2. Programming Assignment.

    This assignment will approximate a function using cubic splines.  We will experiment with changing the number of knots and measuring the error in the approximation, for several different functions. The programming and graphing should be done in Matlab for this assignment.

(a) Write a program in Matlab that takes as input the number  n = number of equally spaced knots k_i ina specified interval [a,b], and function values equal to f(k_i), and compute the cubic spline for those knots.  (Do not simply call the spline routine from the toolbox; you must write your own, although you can use the Matlab routine for help with debugging.)  For each value of n from 4 to 50, plot the function and the interpolant over the interval. To plot the functions, simply evaluate them at several hundred points in the interval and use the Matlab function plot. Output the error in both the 2 norm and maximum norm at the midpoint of each interval.

(b) Apply your routines to three different functions

What different behavior do you observe? How does the error change with increasing n?
 

To Hand In:
  copy of Matlab code, written discussion and explanation, sample output,  graphs.