clc;
close all;
x=input("Enter values of xi");
y=input("Enter values of fi");
n=length(x);
p=input("Enter point");
for i=1:n
l(i)=1.0;
for j=1:n
if(j~=i)
l(i)=((p-x(j))/(x(i)-x(j)))*l(i);
end
end
end
sum=0.0;
for i=1:n
sum=sum+l(i)*y(i);
end
disp(sum);
Cite As
Akshay (2026). na-lab-lagrange (https://www.mathworks.com/matlabcentral/fileexchange/120413-na-lab-lagrange), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2022b
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0 |
