You are on page 1of 1

LANGRANGES INTERPOLATION

Table of Contents
INPUT .............................................................................................................................. 1
PROGRAM & RESULT ...................................................................................................... 1
OUTPUT ........................................................................................................................... 1
SOLVER ........................................................................................................................... 1

Name : Shubham Chapparghare


Roll no. : 351013

INPUT
SC_LAG([1 1.2 1.3 1.5],[1 1.0954 1.1402 1.2247],1.1)

PROGRAM & RESULT


function[]=SC_LAG(x,y,xr)

n=length(x);
yr=0;
for i=1:n
l=1;
for j=1:n
if i~=j
l=l*((xr-x(j))/(x(i)-x(j)));
end
end
yr=yr+y(i)*l;
end
fprintf('The value of the given function is %f\n',yr);

The value of the given function is 1.048713

OUTPUT
The value of the given function is 1.048713

SOLVER
• interp1([1 1.2 1.3 1.5],[1 1.0954 1.1402 1.2247],1.1)

• ans = 1.0477

Published with MATLAB® R2017a

You might also like