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

TXT
Newton's method for MATLAB Code
PPTX
The Moore-Spiegel Oscillator
PPTX
Share test
DOC
Syed Ubaid Ali Jafri - Cryptography Techniques
DOC
Ececececuacion de primer grado y
PDF
All I Needed for Functional Programming I Learned in High School Algebra
DOCX
HOTEL MANGEMENT
Newton's method for MATLAB Code
The Moore-Spiegel Oscillator
Share test
Syed Ubaid Ali Jafri - Cryptography Techniques
Ececececuacion de primer grado y
All I Needed for Functional Programming I Learned in High School Algebra
HOTEL MANGEMENT

What's hot (15)

PDF
Complex Integral
DOCX
PythonArtCode
PDF
Program to reflecta triangle
TXT
Gp
DOCX
Segundo Punto
PDF
Trapezoidal log log
PPTX
Session07 recursion
PPTX
حساب النهايات جبرياً
DOCX
Interpolation graph c++
PDF
Rolle's theorem
PDF
CAML考古学
PPT
ML: A Strongly Typed Functional Language
PDF
Math 3-H6
PDF
Mac Interview Workshop 2021
Complex Integral
PythonArtCode
Program to reflecta triangle
Gp
Segundo Punto
Trapezoidal log log
Session07 recursion
حساب النهايات جبرياً
Interpolation graph c++
Rolle's theorem
CAML考古学
ML: A Strongly Typed Functional Language
Math 3-H6
Mac Interview Workshop 2021
Ad

More from Taimoor Muzaffar Gondal (20)

PDF
Basics of Computer
PPTX
Lecture 04: Errors During the Measurement Process
PDF
Introduction to Measurements-Lecture 01
PPTX
Updated Lecture 01- History of Atom
PPTX
Heat and Its Transfer
PPTX
Low, Medium and High Frequency Current
PPTX
Rectification and Electrotherapy
PPTX
Applications of EM Waves
PPTX
Electromagnetism Fundamentals
PPTX
Effects of Currents and Type of Cells and Batteries
PPTX
Current Electricity
PPTX
Static Electricity
PPTX
Lecture 01- Atomic Structure
PPTX
An Overview of PLC
TXT
Regula falsi MATLAB Code
TXT
Jacobi method for MATLAB
TXT
Gauss seidal Matlab Code
TXT
Finite difference Matlab Code
TXT
Divided difference Matlab code
TXT
Bisection methode alternate
Basics of Computer
Lecture 04: Errors During the Measurement Process
Introduction to Measurements-Lecture 01
Updated Lecture 01- History of Atom
Heat and Its Transfer
Low, Medium and High Frequency Current
Rectification and Electrotherapy
Applications of EM Waves
Electromagnetism Fundamentals
Effects of Currents and Type of Cells and Batteries
Current Electricity
Static Electricity
Lecture 01- Atomic Structure
An Overview of PLC
Regula falsi MATLAB Code
Jacobi method for MATLAB
Gauss seidal Matlab Code
Finite difference Matlab Code
Divided difference Matlab code
Bisection methode alternate
Ad

Recently uploaded (20)

PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Construction Project Organization Group 2.pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
DOCX
573137875-Attendance-Management-System-original
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
PPT
Drone Technology Electronics components_1
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
ETO & MEO Certificate of Competency Questions and Answers
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Construction Project Organization Group 2.pptx
Mechanical Engineering MATERIALS Selection
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Arduino robotics embedded978-1-4302-3184-4.pdf
Lesson 3_Tessellation.pptx finite Mathematics
573137875-Attendance-Management-System-original
CYBER-CRIMES AND SECURITY A guide to understanding
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Lecture Notes Electrical Wiring System Components
OOP with Java - Java Introduction (Basics)
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
Drone Technology Electronics components_1
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
ETO & MEO Certificate of Competency Questions and Answers

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