Question: In matlab class name: Numerical methods/programming Goal: Compare the cubic not-a-knot spline and interpolating polynomial for the same data Use 7-9 data points. Plot both

In matlab

class name: Numerical methods/programming

In matlab class name: Numerical methods/programming Goal: Compare the cubic "not-a-knot" spline

Goal: Compare the cubic "not-a-knot" spline and interpolating polynomial for the same data Use 7-9 data points. Plot both the spline and the data used for it. For comparison, also plot the interpolating polynomial through these points. Make your conclusion about which method results in a better-looking curve. Method: we'll use built-in Matlab routine spline for this purpose. It takes three arguments r, y,t where (, y) are data points and t are the points at which the spline is to be computed. Typically, t is some vector suitable for plotting e.g., generated with linspace % x-values of your data % y-values of your data % mark the points with red asterisks plot (x,y,'r#9 hold on tlinspace (min(x), max (x)); s -spline(x,y,t); plot (t,s) % the points for plotting curves % evaluate cubic spline at points of t % plot it % proceed to compute and plot interpolating polynomial % Use another color, such as magenta (n) In a comment, state your observation about how the behavior of these two curves (blue and magenta) is different

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!