Question
Write a Matlab function that computes the linear spline interpolation for a given data set. You might need to take a look at the file
Write a Matlab function that computes the linear spline interpolation for a given data set. You might need to take a look at the file cspline_eval.m in Section 3.4 for some hints. Name your Matlab function lspline . This can be defined in the file lspline.m , which should begin with: function ls=lspline(t,y,x)
% lspline computes the linear spline
% Inputs:
% t: vector, contains the knots
% y: vector, contains the interpolating values at knots
% x: vector, contains points where the lspline function
% should be evaluated and plotted
% Output:
% ls: vector, contains the values of lspline at points x
Use your Matlab function lspline on the given data set in Problem 2, plot the linear spline for the interval [1 . 2 , 2 . 2].
What to hand in: Hand in the Matlab file lspline.m , and your plots.
Your task. Write a Matlab function that computes the linear spline interpolation for a given data set. You might need to take a look at the file cspline_eval.m in Section 3.4 for some hints. Name your Matlab function lspline. This can be defined in the file 1spline.m, which should begin with function ls-lspline (t,y,x) % |spline computes the linear spline % inputs: t: vector, contains the knots %y: vector, contains the interpolating values at knots %x: vector, contains points where the lspline function should be evaluated and plotted % Output: % 1s: vector, contains the values of lspline at points x Use your Matlab function 1spline on the given data set in Problem 2, plot the inear spline for the interval 1.2,2.2. What to hand in: Hand in the Matlab file 1spline.m, and your plots
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started