In the following solution, initially the equation and the plot of the given case is computed, then the new set is computed when point P2 moves. Then lastly the effect of movement of P2 is discussed.
CASE 1 :
In the first case, the equation of the cubic splines may be computed using the following code, to get the results.
Equation Code
And the Results are :
Plotting the spline :
To plot the spline, follow this simple code,
x = [1 2 3 5];
y = [5 1 3 2];
xx = linspace(0,6,121);
plot(xx,csapi(x,y,xx),x,y,'ro')
title('Cubic Spline Interpolant to Four Points')
xlabel('x')
ylabel('y')
CASE 2 :
Now if the point P2 moves to (2,6), put the new values to x and y arrays in the above code, as follows,
x = [1,2,3,5];
y = [5,6,3,2];
Equation Results :
Plot :
Effect of Movement of P2 :
Here since the point P2 is moved along the y axis, such that it reaches the highest point in the data set given. This causes the slope of the spline to be exactly reversed. This is because the new highest point decides the slope and it must be a maxima. Hence, the slopes at other locations have to be reversed and so we achieve almost a replica of the curve.
NOTE : Feel free to ask any further queries in the comment section, down below.
I would appreciate if someone solve this using matlab? Four data points wew collected during a...