
c99ea38416a75d2614bcd77f88dce3b3.ppt
- Количество слайдов: 9
Mathematical Modeling and Simulation Using MATLAB Interpolation and Curve Fitting Prof. Muhammad Saeed
q 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) %derivative Example: Poly_05. m c = polyder(a, b) %derivative of product Example: Poly_06. m [n, d] = polyder(a, b) Mathematical Modeling and Simulation division %derivative of 2
……. . Polynomials: intgrl = polyint(p) Example: Poly_09. m intgrl = polyint(p, c) Example: Poly_10. m r = roots(p) Example: Poly_11. m p = poly(r) Example: Poly_12. m p = poly(x) Example: Poly_13. m Mathematical Modeling and Simulation integral of polynomial ‘p’ c a constant of integration roots of polynomial ‘p’ polynomial of roots ‘r’ x must be a square matrix p is characteristic polynomial 3
q Interpolation I: interp 1(x, y, a), Example: Interp. Fit_01. m interp 1(x, y, a, ’linear’), Interp. Fit_01 b. m interp 1(x, y, a, ’cubic’), interp 1(x, y, a, ’spline’), Interp 1(x, y, a, ’nearest’) interp 2(x, y, z, a, b, ’ ……. . ‘) , [xx, yy]=meshgrid(x, y), mesh() Example: Interp. Fit_02. m interp 3 interp 1 q, %it is quicker than ‘interp 1’ on non-uniformly spaced data because it does no input checking interpft, interpn Mathematical Modeling and Simulation 4
q Interpolation II: tri=delaunay(x, y), trimesh(tri, x, y, z), tsearch(x, y, tri, [x b], [c d]), dsearch Example: Random. Data. Interp_01 [pts, area] = convhull(x, y) Example: Random. Data. Interp_02 voronoi(x, y) Example: Random. Data. Interp_03 griddata Example: Random. Data. Interp_04 Mathematical Modeling and Simulation 5
q Curve Fitting: p = polyfit(x, y, n) Example: Poly. Fits_01. m [p, s] = polyfit(x, y, n) [p, s, μ ] = polyfit(x, y, n) yi = spline(x, y, xi) Example: Spline. Fits_01. m pp=spline(x, y), yi=ppval(pp, xi) hp = pchip(x, y), Example: Hermite. Spline. Fits_01. m Mathematical Modeling and Simulation 6
Colormap Mathematical Modeling and Simulation
Test Matrices: binomial chow condex fiedler gcdmat invhess kahan lehmer minij parter randcolu rando ris triw cauchy circul cycol forsythe frank grcar invol kms leslie moler pei randcorr randsvd redheff smoke wathen chebspec chebvand clement compar dorr dramadah gearmat hanowa house ipjfact jordbloc krylov lauchli lesp lotkin neumann orthog poisson prolate randhess randjorth riemann toeppd tridiag wilk A=gallery(‘binomial’, n) Mathematical Modeling and Simulation 8
End Mathematical Modeling and Simulation 9
c99ea38416a75d2614bcd77f88dce3b3.ppt