Programming Assignment 2

Cubic Interpolatory Spline

General

This assignment extends piecewise cubic Hermite interpolation to the cubic interpolatory spline.

Your program should accomplish the following:

  • Allow the user to enter several data points which will be displayed on the screen.

  • Generate a C2 cubic interpolatory curve through these points, using non-uniform knot spacing.

Code

  • You may program in any language, although Matlab is recommended. If your program is in a language other than Matlab, Mathematica,  C/C++, or Java, I may ask you to demonstrate it. 

  • Any package can be used for the viewing purpose. You should not use build-in functions in Matlab, Mathematica, or other packages for generating cubic interpolatory spline.

  • Your code should be readable. The first part of every function should contain a block of comments that give a detailed description of the code's purpose, usage, and its input and output variables.

  • Your code should return warning and error messages for invalid input data.

Input/Output

All values in the following descriptions are floating point, unless preceded by int.

The input will consist of a file in the following form:

(int) Number of Control Points

x0     y0

x1     y1

x2     y2

...     ...

xn     yn

What you should hand-in

Please hand in

  • All of your source code

  • A brief description of how to compile and run your code