Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
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