(a) Matlab problem Write a MATLAB function z = spline3.coeff (t, y) that takes as input the knot vector t = [0,₁.....] and the function values y = [yo. Y...] and returns the vector z = [0= 20, 21, 22, 2-1,2n = 0]. The z vector is computed by setting up and solving a tridiagonal system as dis cussed during the lecture. You can use the MATLAB backslash for solving the tridiagonal system.
(b) Matlab problem Compute the natural cubic spline, S(r), using the function you just wrote for t = [-1 = 0, 1 = 1] and y = [yo = f(ro), y₁ = f(₁),...Un f(x)] for n = 11 and plot S(r) as well as f(x) on [-1.1]. How does the natural cubic spline behave relative to the polynomial interpolation from the previous homework?
You may use the function eval_spine.m, provided with this assignment, to evaluate S(x).
- Voclasses