Question 2. Consider the data in the following table: |-9 | 0 | 2 | 6 y 31 50 90
ID: 2256325 • Letter: Q
Question
Question 2. Consider the data in the following table: |-9 | 0 | 2 | 6 y 31 50 90 99 (a) Written By hand, determine the system of linear equations that needs to be solved in order to fit a natural cubic spline with individual cubic polynomial segments of the form G(z) = aizs + biz2 + c + di for x € , zi+1] to the above data set. Solve the resulting system with the help of MATLAB's rref function, and hence determine the equations that define the overall spline (b) MATLAB: Use MATLAB to plot the original data points, and on the same graph the natural spline that you determined in part (a). In addition, use MATLAB's built-in spline function to fit a spline to the given data, and superimpose this spline on your gr (c) Written: Do the natural spline and the spline generated via MATLAB's spline function coincide? Is this resmult to be expected, and why aph.Explanation / Answer
Solution:
2.a)
The following data table is provided:
X
-9
0
2
6
y
-31
50
90
99
The value of the (x,y) are specifying the points of a curve i.e. {x(t),y(t)}.Here we have to reconstruct the curve with the help of cubic splines and interpolating independently. The value of t is unknown here, we have to determine the value of t to compute the splines coefficient:
Let’s say, t1 = 0 ;
tk= tk-1 +
where k= 2,3,4…..n
From here we can calculate the spline coefficient (ai,bi,ci,di) for cubic splines interpolating x(t) and y(t).
Considering this linear equations MATLAB functions interp1(x,y,xi,’linear’ ) and interp1(x,y,xi,’spline’) are also based. The linear splines basically represent the line of segments between two points i.e. (Vk,Ik) and (Vk+1,Ik+1). The simplest form of the line segment is: Ik(V) = Ik + ( Ik+1 - Ik) ( V - Vk ) / (Vk+1 - Vk), where k belongs to 0…..n.
However the resulting curve may not be in smooth manner but it can be determined as exact according to the values.
We can compute the cubic splines using: I k(V) = Ik + ak ( V - Vk ) + bk ( V - Vk )2 + ck ( V - Vk )3
Where V can be denoted as (Vk, Vk+1)
So as mentioned earlier the suitable procedure to find out the coefficients:
ak = ( Ik+1 - Ik ) / (Vk+1 - Vk ) - (2 mk + mk+1) ( Vk+1 - Vk ) / 6
bk = 0.5 mk, ck = 1/6 ( mk+1 - mk ) / (Vk+1-Vk)
Where mk are the subject boundary conditions.
Note that if all mk are 0’s cubic splines will be decreased to linear splines.
Please go through that I have only answered for the part a.
X
-9
0
2
6
y
-31
50
90
99
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.