Interpolation and Curve Fitting Prof. Muhammad Saeed Mathematical Modeling and Simulation...
-
Upload
rebecca-power -
Category
Documents
-
view
225 -
download
1
Transcript of Interpolation and Curve Fitting Prof. Muhammad Saeed Mathematical Modeling and Simulation...
![Page 1: Interpolation and Curve Fitting Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB.](https://reader038.fdocuments.net/reader038/viewer/2022110303/5514d80a55034693478b531b/html5/thumbnails/1.jpg)
Interpolation and
Curve FittingProf. Muhammad Saeed
Mathematical Modeling and Simulation
UsingMATLABMATLAB
![Page 2: Interpolation and Curve Fitting Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB.](https://reader038.fdocuments.net/reader038/viewer/2022110303/5514d80a55034693478b531b/html5/thumbnails/2.jpg)
22Mathematical Modeling and Simulation
Polynomials:p = [1 -2 3 6] , y = polyval(p, x) %definition Examples: Poly_01.m , Poly_02.m
c = conv(a,b) % multiplication Example: Poly_03.m
[q, r]=deconv(a,b) % division Example: Poly_04.m
c = polyder(p)%derivativeExample: Poly_05.m
c = polyder(a,b)%derivative of productExample: Poly_06.m
[n,d] = polyder(a,b) %derivative of divisionExample: Poly_07.m
![Page 3: Interpolation and Curve Fitting Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB.](https://reader038.fdocuments.net/reader038/viewer/2022110303/5514d80a55034693478b531b/html5/thumbnails/3.jpg)
33Mathematical Modeling and Simulation
intgrl = polyint(p) integral of polynomial ‘p’Example: Poly_09.m
intgrl = polyint(p, c) integral of polynomial ‘p’ Example: Poly_10.m c a constant of
integration r = roots(p) roots of polynomial ‘p’Example: Poly_11.m
p = poly(r) polynomial of roots ‘r’Example: Poly_12.m
p = poly(x) x must be a square matrix Example: Poly_13.m p is characteristic polynomial
……..Polynomials:
![Page 4: Interpolation and Curve Fitting Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB.](https://reader038.fdocuments.net/reader038/viewer/2022110303/5514d80a55034693478b531b/html5/thumbnails/4.jpg)
44Mathematical Modeling and Simulation
Interpolation I:interp1(x,y,a), Example: InterpFit_01.m
interp1(x,y,a,’linear’), InterpFit_01b.m
interp1(x,y,a,’cubic’),interp1(x,y,a,’spline’), Interp1(x,y,a,’nearest’)interp2(x,y,z,a,b,’ …….. ‘) , [xx,yy]=meshgrid(x,y), mesh()
Example: InterpFit_02.m
interp3interp1q, %it is quicker than ‘interp1’ on non-uniformly
spaced data because it does no input checkinginterpft, interpn
![Page 5: Interpolation and Curve Fitting Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB.](https://reader038.fdocuments.net/reader038/viewer/2022110303/5514d80a55034693478b531b/html5/thumbnails/5.jpg)
55Mathematical Modeling and Simulation
Interpolation II:tri=delaunay(x,y), trimesh(tri,x,y,z),tsearch(x,y,tri,[x b],[c d]), dsearch
Example: RandomDataInterp_01
[pts,area] = convhull(x,y) Example: RandomDataInterp_02
voronoi(x,y) Example: RandomDataInterp_03
griddata Example: RandomDataInterp_04
![Page 6: Interpolation and Curve Fitting Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB.](https://reader038.fdocuments.net/reader038/viewer/2022110303/5514d80a55034693478b531b/html5/thumbnails/6.jpg)
66Mathematical Modeling and Simulation
Curve Fitting: p = polyfit(x,y,n) Example: PolyFits_01.m
[p, s] = polyfit(x,y,n)[p,s,μ ] = polyfit(x,y,n)
yi = spline(x,y,xi) Example: SplineFits_01.m
pp=spline(x,y), yi=ppval(pp,xi)hp = pchip(x,y), Example: HermiteSplineFits_01.m
![Page 7: Interpolation and Curve Fitting Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB.](https://reader038.fdocuments.net/reader038/viewer/2022110303/5514d80a55034693478b531b/html5/thumbnails/7.jpg)
Colormap
77Mathematical Modeling and Simulation
![Page 8: Interpolation and Curve Fitting Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB.](https://reader038.fdocuments.net/reader038/viewer/2022110303/5514d80a55034693478b531b/html5/thumbnails/8.jpg)
88Mathematical Modeling and Simulation
Test Matrices:
binomial cauchy chebspec chebvandchow circul clement comparcondex cycol dorr dramadahfiedler forsythe frank gearmatgcdmat grcar hanowa houseinvhess invol ipjfact jordblockahan kms krylov lauchlilehmer leslie lesp lotkinminij moler neumann orthogparter pei poisson prolaterandcolu randcorr randhess randjorthrando randsvd redheff riemannris smoke toeppd tridiagtriw wathen wilk
A=gallery(‘binomial’, n)
![Page 9: Interpolation and Curve Fitting Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB.](https://reader038.fdocuments.net/reader038/viewer/2022110303/5514d80a55034693478b531b/html5/thumbnails/9.jpg)
End
99Mathematical Modeling and Simulation