SlideShare a Scribd company logo
BY
Uday Saikia
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
>> p=[1 -12.1 40.59 -17.015 -71.95 35.88]
>> r=roots(p)
r=
6.5000
4.0000
2.3000
-1.2000
0.5000
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
6x-2
p=polyfit(x,y,n)
here p=A vector of the co-efficients of
the polynomial that fits the
data
co-

x=A vector with the horizontal
ordinate of the data points
y= A vector with the vertical
co-ordinate of the data points
n=Degree of polynomial
Here,

‘nearest’ : returns the value of the
data point that is nearest to the
yi = interpl (x, y, xi, ‘method’) interpolated point
‘linear’ : uses linear spline
interpolation
‘spline’ : uses cubic spline
interpolation
yi = It is Interpolated value
‘pchip’ : uses piecewise cubic Hermite
interpolation

x = It is a vector with horizontal co-ordinate of the input data
points

y = It is a vector with vertical co-ordinate of the input data points
xi = Horizontal co-ordinate of the interpolation point
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
x

0

1

2

y

1.0

-0.6242 -1.4707

3

4

5

3.2406

-0.7366 -6.3717
>> x=[0:1.0:5];
y=[1.0 -0.6242 -1.4707 3.2406 -0.7366 -6.3717];
xi=[0:0.1:5];
yilin=interpl(x,y,xi,'linear');
yispl=interpl(x,y,xi,'spline');
yipch=interpl(x,y,xi,'pchip');
yfun=1.5.^xi*cos(2*xi);
subplot(1,3,1)
plot(x,y,'o'xi,yfun,xi,yilin,'--');
subpolt(1,3,2)
plot(x,y,'o',xi,yfun,xi,yispl,'--');
subplot(1,3,3)
plot(x,y,'o',xi,yfun,xi,yipch,'--')
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
Mesh & Surface plots are created in three steps:
*create a grid in the x-y plane
*calculate the value of z at each point of the grid
*create the plot
POLYNOMIALS,CURVEFITTING, AND INTERPOLATION
>> x=-1:0.1:3;
>> y=1:0.1:4;
>> [X,Y]=meshgrid(x,y);
>> Z=X.*Y.^2./(X.^2+Y.^2);
>> mesh(X,Y,Z)
>> xlabel('x');
>> ylabel('y');
>> zlabel('z');

More Related Content

PPTX
Linear regression by Kodebay
PPTX
Image stitching
PPTX
Random number generation
PDF
Performance Evaluation for Scattered Data Interpolation
PDF
Random Photos
PDF
Radial Basis Function Interpolation
PDF
Image interpolation
PPT
Interpolation 1
Linear regression by Kodebay
Image stitching
Random number generation
Performance Evaluation for Scattered Data Interpolation
Random Photos
Radial Basis Function Interpolation
Image interpolation
Interpolation 1

More from Dr. Uday Saikia (6)

PPT
Middleware
PPTX
LPC for Speech Recognition
PPTX
Brain Computer Interfaces(BCI)
PDF
Intelligence and artificial intelligence
PPTX
Quality management
PPTX
Artificial Neural Network / Hand written character Recognition
Middleware
LPC for Speech Recognition
Brain Computer Interfaces(BCI)
Intelligence and artificial intelligence
Quality management
Artificial Neural Network / Hand written character Recognition
Ad

Recently uploaded (20)

PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Classroom Observation Tools for Teachers
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
01-Introduction-to-Information-Management.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Cell Types and Its function , kingdom of life
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Complications of Minimal Access Surgery at WLH
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Classroom Observation Tools for Teachers
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
01-Introduction-to-Information-Management.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Cell Types and Its function , kingdom of life
Anesthesia in Laparoscopic Surgery in India
O5-L3 Freight Transport Ops (International) V1.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
O7-L3 Supply Chain Operations - ICLT Program
Complications of Minimal Access Surgery at WLH
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Microbial diseases, their pathogenesis and prophylaxis
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Ad

POLYNOMIALS,CURVEFITTING, AND INTERPOLATION

  • 7. >> p=[1 -12.1 40.59 -17.015 -71.95 35.88] >> r=roots(p) r= 6.5000 4.0000 2.3000 -1.2000 0.5000
  • 12. 6x-2
  • 13. p=polyfit(x,y,n) here p=A vector of the co-efficients of the polynomial that fits the data co- x=A vector with the horizontal ordinate of the data points y= A vector with the vertical co-ordinate of the data points n=Degree of polynomial
  • 14. Here, ‘nearest’ : returns the value of the data point that is nearest to the yi = interpl (x, y, xi, ‘method’) interpolated point ‘linear’ : uses linear spline interpolation ‘spline’ : uses cubic spline interpolation yi = It is Interpolated value ‘pchip’ : uses piecewise cubic Hermite interpolation x = It is a vector with horizontal co-ordinate of the input data points y = It is a vector with vertical co-ordinate of the input data points xi = Horizontal co-ordinate of the interpolation point
  • 17. >> x=[0:1.0:5]; y=[1.0 -0.6242 -1.4707 3.2406 -0.7366 -6.3717]; xi=[0:0.1:5]; yilin=interpl(x,y,xi,'linear'); yispl=interpl(x,y,xi,'spline'); yipch=interpl(x,y,xi,'pchip'); yfun=1.5.^xi*cos(2*xi); subplot(1,3,1) plot(x,y,'o'xi,yfun,xi,yilin,'--'); subpolt(1,3,2) plot(x,y,'o',xi,yfun,xi,yispl,'--'); subplot(1,3,3) plot(x,y,'o',xi,yfun,xi,yipch,'--')
  • 22. Mesh & Surface plots are created in three steps: *create a grid in the x-y plane *calculate the value of z at each point of the grid *create the plot
  • 24. >> x=-1:0.1:3; >> y=1:0.1:4; >> [X,Y]=meshgrid(x,y); >> Z=X.*Y.^2./(X.^2+Y.^2); >> mesh(X,Y,Z) >> xlabel('x'); >> ylabel('y'); >> zlabel('z');