Question: This is what I got down so far, but it doesn't run function Yint=LagrangeINT(x,y,Xint) %input variables: x=[-2,1,3,5] y=[0,-1.95,-1.25,-1.75] %Xint the x coordinate of the point

This is what I got down so far, but it doesn't run

function Yint=LagrangeINT(x,y,Xint)

%input variables:

x=[-2,1,3,5]

y=[0,-1.95,-1.25,-1.75]

%Xint the x coordinate of the point at which y is to be interplted

%out =put variable

%Yint the interpolated value of Xint

n=length(x)

for i=1:n

L(i)=1;

for j=1:n

if j~=i

L(i)=L(i)*(Xint-x(j))/(x(i)-x(j));

end

end

Yint=sum(y.*L);

end

end

 This is what I got down so far, but it doesn't

2. 10 points (no need to submit your code for this problem) The set of 4 data points are given below: -2 1.95 1.25 1.75 (2a) Using Lagrange interpolation method to find the 3rd order polynomial that passes through the data points. Provide the details of the four Lagrange base functions. Use the interpolation result to calculate the value of yatx-2; (2b) Make the following plots: (i) the original data and the 3rd order polynomial together as a single plot; (ii) the four Lagrange base functions 2. 10 points (no need to submit your code for this problem) The set of 4 data points are given below: -2 1.95 1.25 1.75 (2a) Using Lagrange interpolation method to find the 3rd order polynomial that passes through the data points. Provide the details of the four Lagrange base functions. Use the interpolation result to calculate the value of yatx-2; (2b) Make the following plots: (i) the original data and the 3rd order polynomial together as a single plot; (ii) the four Lagrange base functions

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!