SlideShare a Scribd company logo
function[p]=langrange(x,xint,y)
x=[1 2 5];
y=[1 4 10];
xint=3;
n=size(x,2)
L=ones(n,size(xint,2));
if (size(x,2)~=size(y,2));
fprint('error x and y have same values')
else
for i=1:n
for j=1:n
if(i~=j)
L(i,:)=L(i,:)*(xint-x(j))/(x(i)-x(j));
end
end
end
p=0;
for i=1:n
p=p+y(i)*(L(i,:));
end
end
--------------------
Taimoor Gondal
Asim Zahid
Umar Cheema

More Related Content

What's hot (15)

Complex Integral
Complex IntegralComplex Integral
Complex Integral
Mikołaj Hajduk
 
PythonArtCode
PythonArtCodePythonArtCode
PythonArtCode
Quinn McFee
 
Program to reflecta triangle
Program to reflecta triangleProgram to reflecta triangle
Program to reflecta triangle
Tanya Makkar
 
Gp
GpGp
Gp
kwek62
 
Segundo Punto
Segundo PuntoSegundo Punto
Segundo Punto
gustavo206
 
Trapezoidal log log
Trapezoidal log logTrapezoidal log log
Trapezoidal log log
Patrick Hui
 
Session07 recursion
Session07 recursionSession07 recursion
Session07 recursion
HarithaRanasinghe
 
حساب النهايات جبرياً
حساب النهايات جبرياًحساب النهايات جبرياً
حساب النهايات جبرياً
sdthgpr
 
Interpolation graph c++
Interpolation graph c++Interpolation graph c++
Interpolation graph c++
rpiitcbme
 
Rolle's theorem
Rolle's theorem Rolle's theorem
Rolle's theorem
TUPESDREAMER
 
CAML考古学
CAML考古学CAML考古学
CAML考古学
dico_leque
 
متاپست (MetaPost)
متاپست (MetaPost)متاپست (MetaPost)
متاپست (MetaPost)
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
ML: A Strongly Typed Functional Language
ML: A Strongly Typed Functional LanguageML: A Strongly Typed Functional Language
ML: A Strongly Typed Functional Language
lijx127
 
Math 3-H6
Math 3-H6Math 3-H6
Math 3-H6
jjlendaya
 
Mac Interview Workshop 2021
Mac Interview Workshop 2021Mac Interview Workshop 2021
Mac Interview Workshop 2021
Michael Viveros
 

More from Taimoor Muzaffar Gondal (20)

Basics of Computer
Basics of ComputerBasics of Computer
Basics of Computer
Taimoor Muzaffar Gondal
 
Lecture 04: Errors During the Measurement Process
Lecture 04: Errors During the Measurement ProcessLecture 04: Errors During the Measurement Process
Lecture 04: Errors During the Measurement Process
Taimoor Muzaffar Gondal
 
Introduction to Measurements-Lecture 01
Introduction to Measurements-Lecture 01Introduction to Measurements-Lecture 01
Introduction to Measurements-Lecture 01
Taimoor Muzaffar Gondal
 
Updated Lecture 01- History of Atom
Updated Lecture 01- History of AtomUpdated Lecture 01- History of Atom
Updated Lecture 01- History of Atom
Taimoor Muzaffar Gondal
 
Heat and Its Transfer
Heat and Its TransferHeat and Its Transfer
Heat and Its Transfer
Taimoor Muzaffar Gondal
 
Low, Medium and High Frequency Current
Low, Medium and High Frequency CurrentLow, Medium and High Frequency Current
Low, Medium and High Frequency Current
Taimoor Muzaffar Gondal
 
Rectification and Electrotherapy
Rectification and ElectrotherapyRectification and Electrotherapy
Rectification and Electrotherapy
Taimoor Muzaffar Gondal
 
Applications of EM Waves
Applications of EM WavesApplications of EM Waves
Applications of EM Waves
Taimoor Muzaffar Gondal
 
Electromagnetism Fundamentals
Electromagnetism FundamentalsElectromagnetism Fundamentals
Electromagnetism Fundamentals
Taimoor Muzaffar Gondal
 
Effects of Currents and Type of Cells and Batteries
Effects of Currents and Type of Cells and BatteriesEffects of Currents and Type of Cells and Batteries
Effects of Currents and Type of Cells and Batteries
Taimoor Muzaffar Gondal
 
Current Electricity
Current ElectricityCurrent Electricity
Current Electricity
Taimoor Muzaffar Gondal
 
Static Electricity
Static ElectricityStatic Electricity
Static Electricity
Taimoor Muzaffar Gondal
 
Lecture 01- Atomic Structure
Lecture 01- Atomic StructureLecture 01- Atomic Structure
Lecture 01- Atomic Structure
Taimoor Muzaffar Gondal
 
An Overview of PLC
An Overview of PLCAn Overview of PLC
An Overview of PLC
Taimoor Muzaffar Gondal
 
Regula falsi MATLAB Code
Regula falsi MATLAB CodeRegula falsi MATLAB Code
Regula falsi MATLAB Code
Taimoor Muzaffar Gondal
 
Jacobi method for MATLAB
Jacobi method for MATLAB Jacobi method for MATLAB
Jacobi method for MATLAB
Taimoor Muzaffar Gondal
 
Gauss seidal Matlab Code
Gauss seidal Matlab CodeGauss seidal Matlab Code
Gauss seidal Matlab Code
Taimoor Muzaffar Gondal
 
Finite difference Matlab Code
Finite difference Matlab CodeFinite difference Matlab Code
Finite difference Matlab Code
Taimoor Muzaffar Gondal
 
Divided difference Matlab code
Divided difference Matlab codeDivided difference Matlab code
Divided difference Matlab code
Taimoor Muzaffar Gondal
 
Bisection methode alternate
Bisection methode alternateBisection methode alternate
Bisection methode alternate
Taimoor Muzaffar Gondal
 
Lecture 04: Errors During the Measurement Process
Lecture 04: Errors During the Measurement ProcessLecture 04: Errors During the Measurement Process
Lecture 04: Errors During the Measurement Process
Taimoor Muzaffar Gondal
 
Effects of Currents and Type of Cells and Batteries
Effects of Currents and Type of Cells and BatteriesEffects of Currents and Type of Cells and Batteries
Effects of Currents and Type of Cells and Batteries
Taimoor Muzaffar Gondal
 

Recently uploaded (20)

MS Project - Pelaksanaan Proyek Fisik 2020
MS Project - Pelaksanaan Proyek Fisik 2020MS Project - Pelaksanaan Proyek Fisik 2020
MS Project - Pelaksanaan Proyek Fisik 2020
Bagus ardian
 
PPT on Grid resilience against Natural disasters.pptx
PPT on Grid resilience against Natural disasters.pptxPPT on Grid resilience against Natural disasters.pptx
PPT on Grid resilience against Natural disasters.pptx
manesumit66
 
Department of Environment (DOE) Mix Design with Fly Ash.
Department of Environment (DOE) Mix Design with Fly Ash.Department of Environment (DOE) Mix Design with Fly Ash.
Department of Environment (DOE) Mix Design with Fly Ash.
MdManikurRahman
 
2. CT M35 Grade Concrete Mix design ppt.pdf
2. CT M35 Grade Concrete Mix design  ppt.pdf2. CT M35 Grade Concrete Mix design  ppt.pdf
2. CT M35 Grade Concrete Mix design ppt.pdf
smghumare
 
Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine, Issue 53 / Spring 2025Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine
 
Introduction-to-Prestressed-Concrete.pdf
Introduction-to-Prestressed-Concrete.pdfIntroduction-to-Prestressed-Concrete.pdf
Introduction-to-Prestressed-Concrete.pdf
Bharti Shinde
 
Advanced Concrete Technology- Properties of Admixtures
Advanced Concrete Technology- Properties of AdmixturesAdvanced Concrete Technology- Properties of Admixtures
Advanced Concrete Technology- Properties of Admixtures
Bharti Shinde
 
MODULE 5 BUILDING PLANNING AND DESIGN SY BTECH ACOUSTICS SYSTEM IN BUILDING
MODULE 5 BUILDING PLANNING AND DESIGN SY BTECH ACOUSTICS SYSTEM IN BUILDINGMODULE 5 BUILDING PLANNING AND DESIGN SY BTECH ACOUSTICS SYSTEM IN BUILDING
MODULE 5 BUILDING PLANNING AND DESIGN SY BTECH ACOUSTICS SYSTEM IN BUILDING
Dr. BASWESHWAR JIRWANKAR
 
HVAC Air Filter Equipment-Catalouge-Final.pdf
HVAC Air Filter Equipment-Catalouge-Final.pdfHVAC Air Filter Equipment-Catalouge-Final.pdf
HVAC Air Filter Equipment-Catalouge-Final.pdf
FILTRATION ENGINEERING & CUNSULTANT
 
Ceramic Multichannel Membrane Structure with Tunable Properties by Sol-Gel Me...
Ceramic Multichannel Membrane Structure with Tunable Properties by Sol-Gel Me...Ceramic Multichannel Membrane Structure with Tunable Properties by Sol-Gel Me...
Ceramic Multichannel Membrane Structure with Tunable Properties by Sol-Gel Me...
DanyalNaseer3
 
Air Filter Flat Sheet Media-Catalouge-Final.pdf
Air Filter Flat Sheet Media-Catalouge-Final.pdfAir Filter Flat Sheet Media-Catalouge-Final.pdf
Air Filter Flat Sheet Media-Catalouge-Final.pdf
FILTRATION ENGINEERING & CUNSULTANT
 
Scilab Chemical Engineering application.pptx
Scilab Chemical Engineering  application.pptxScilab Chemical Engineering  application.pptx
Scilab Chemical Engineering application.pptx
OmPandey85
 
Full_Cybersecurity_Project_Report_30_Pages.pdf
Full_Cybersecurity_Project_Report_30_Pages.pdfFull_Cybersecurity_Project_Report_30_Pages.pdf
Full_Cybersecurity_Project_Report_30_Pages.pdf
Arun446808
 
Attenuation Models for Estimation of Vertical Peak Ground Acceleration Based ...
Attenuation Models for Estimation of Vertical Peak Ground Acceleration Based ...Attenuation Models for Estimation of Vertical Peak Ground Acceleration Based ...
Attenuation Models for Estimation of Vertical Peak Ground Acceleration Based ...
Journal of Soft Computing in Civil Engineering
 
1.9 Class,Object,Class Scope,Accessing Class members and Controlling access t...
1.9 Class,Object,Class Scope,Accessing Class members and Controlling access t...1.9 Class,Object,Class Scope,Accessing Class members and Controlling access t...
1.9 Class,Object,Class Scope,Accessing Class members and Controlling access t...
VikasNirgude2
 
world subdivision.pdf...................
world subdivision.pdf...................world subdivision.pdf...................
world subdivision.pdf...................
bmmederos10
 
Software_Engineering_in_6_Hours_lyst1728638742594.pdf
Software_Engineering_in_6_Hours_lyst1728638742594.pdfSoftware_Engineering_in_6_Hours_lyst1728638742594.pdf
Software_Engineering_in_6_Hours_lyst1728638742594.pdf
VanshMunjal7
 
Silent-Aire Quality Orientation - OFCI_GC - EVAP Unit REV2.pdf
Silent-Aire Quality Orientation - OFCI_GC - EVAP Unit REV2.pdfSilent-Aire Quality Orientation - OFCI_GC - EVAP Unit REV2.pdf
Silent-Aire Quality Orientation - OFCI_GC - EVAP Unit REV2.pdf
EfrainGarrilloRuiz1
 
1.10 Functions in C++,call by value .pdf
1.10 Functions in C++,call by value .pdf1.10 Functions in C++,call by value .pdf
1.10 Functions in C++,call by value .pdf
VikasNirgude2
 
Salesforce Hackathon Fun Slide for Everyone
Salesforce Hackathon Fun Slide for EveryoneSalesforce Hackathon Fun Slide for Everyone
Salesforce Hackathon Fun Slide for Everyone
ImtiazBinMohiuddin
 
MS Project - Pelaksanaan Proyek Fisik 2020
MS Project - Pelaksanaan Proyek Fisik 2020MS Project - Pelaksanaan Proyek Fisik 2020
MS Project - Pelaksanaan Proyek Fisik 2020
Bagus ardian
 
PPT on Grid resilience against Natural disasters.pptx
PPT on Grid resilience against Natural disasters.pptxPPT on Grid resilience against Natural disasters.pptx
PPT on Grid resilience against Natural disasters.pptx
manesumit66
 
Department of Environment (DOE) Mix Design with Fly Ash.
Department of Environment (DOE) Mix Design with Fly Ash.Department of Environment (DOE) Mix Design with Fly Ash.
Department of Environment (DOE) Mix Design with Fly Ash.
MdManikurRahman
 
2. CT M35 Grade Concrete Mix design ppt.pdf
2. CT M35 Grade Concrete Mix design  ppt.pdf2. CT M35 Grade Concrete Mix design  ppt.pdf
2. CT M35 Grade Concrete Mix design ppt.pdf
smghumare
 
Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine, Issue 53 / Spring 2025Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine
 
Introduction-to-Prestressed-Concrete.pdf
Introduction-to-Prestressed-Concrete.pdfIntroduction-to-Prestressed-Concrete.pdf
Introduction-to-Prestressed-Concrete.pdf
Bharti Shinde
 
Advanced Concrete Technology- Properties of Admixtures
Advanced Concrete Technology- Properties of AdmixturesAdvanced Concrete Technology- Properties of Admixtures
Advanced Concrete Technology- Properties of Admixtures
Bharti Shinde
 
MODULE 5 BUILDING PLANNING AND DESIGN SY BTECH ACOUSTICS SYSTEM IN BUILDING
MODULE 5 BUILDING PLANNING AND DESIGN SY BTECH ACOUSTICS SYSTEM IN BUILDINGMODULE 5 BUILDING PLANNING AND DESIGN SY BTECH ACOUSTICS SYSTEM IN BUILDING
MODULE 5 BUILDING PLANNING AND DESIGN SY BTECH ACOUSTICS SYSTEM IN BUILDING
Dr. BASWESHWAR JIRWANKAR
 
Ceramic Multichannel Membrane Structure with Tunable Properties by Sol-Gel Me...
Ceramic Multichannel Membrane Structure with Tunable Properties by Sol-Gel Me...Ceramic Multichannel Membrane Structure with Tunable Properties by Sol-Gel Me...
Ceramic Multichannel Membrane Structure with Tunable Properties by Sol-Gel Me...
DanyalNaseer3
 
Scilab Chemical Engineering application.pptx
Scilab Chemical Engineering  application.pptxScilab Chemical Engineering  application.pptx
Scilab Chemical Engineering application.pptx
OmPandey85
 
Full_Cybersecurity_Project_Report_30_Pages.pdf
Full_Cybersecurity_Project_Report_30_Pages.pdfFull_Cybersecurity_Project_Report_30_Pages.pdf
Full_Cybersecurity_Project_Report_30_Pages.pdf
Arun446808
 
1.9 Class,Object,Class Scope,Accessing Class members and Controlling access t...
1.9 Class,Object,Class Scope,Accessing Class members and Controlling access t...1.9 Class,Object,Class Scope,Accessing Class members and Controlling access t...
1.9 Class,Object,Class Scope,Accessing Class members and Controlling access t...
VikasNirgude2
 
world subdivision.pdf...................
world subdivision.pdf...................world subdivision.pdf...................
world subdivision.pdf...................
bmmederos10
 
Software_Engineering_in_6_Hours_lyst1728638742594.pdf
Software_Engineering_in_6_Hours_lyst1728638742594.pdfSoftware_Engineering_in_6_Hours_lyst1728638742594.pdf
Software_Engineering_in_6_Hours_lyst1728638742594.pdf
VanshMunjal7
 
Silent-Aire Quality Orientation - OFCI_GC - EVAP Unit REV2.pdf
Silent-Aire Quality Orientation - OFCI_GC - EVAP Unit REV2.pdfSilent-Aire Quality Orientation - OFCI_GC - EVAP Unit REV2.pdf
Silent-Aire Quality Orientation - OFCI_GC - EVAP Unit REV2.pdf
EfrainGarrilloRuiz1
 
1.10 Functions in C++,call by value .pdf
1.10 Functions in C++,call by value .pdf1.10 Functions in C++,call by value .pdf
1.10 Functions in C++,call by value .pdf
VikasNirgude2
 
Salesforce Hackathon Fun Slide for Everyone
Salesforce Hackathon Fun Slide for EveryoneSalesforce Hackathon Fun Slide for Everyone
Salesforce Hackathon Fun Slide for Everyone
ImtiazBinMohiuddin
 

Langrange method for MATLAB Code

  • 1. function[p]=langrange(x,xint,y) x=[1 2 5]; y=[1 4 10]; xint=3; n=size(x,2) L=ones(n,size(xint,2)); if (size(x,2)~=size(y,2)); fprint('error x and y have same values') else for i=1:n for j=1:n if(i~=j) L(i,:)=L(i,:)*(xint-x(j))/(x(i)-x(j)); end end end p=0; for i=1:n p=p+y(i)*(L(i,:)); end end -------------------- Taimoor Gondal Asim Zahid Umar Cheema