Interpolation and curve fitting
This presentation is the property of its rightful owner.
Sponsored Links
1 / 9

Interpolation and Curve Fitting PowerPoint PPT Presentation


  • 99 Views
  • Uploaded on
  • Presentation posted in: General

Mathematical Modeling and Simulation. Interpolation and Curve Fitting. Using MATLAB. Prof. Muhammad Saeed. 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

Download Presentation

Interpolation and Curve Fitting

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Interpolation and curve fitting

Mathematical Modeling and Simulation

Interpolation and Curve Fitting

Using

MATLAB

Prof. Muhammad Saeed


Interpolation and curve fitting

  • 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)%derivative of division

    • Example: Poly_07.m

Mathematical Modeling and Simulation

2


Interpolation and curve fitting

  • ……..Polynomials:

  • intgrl = polyint(p)integral of polynomial ‘p’

  • Example: Poly_09.m

  • intgrl = polyint(p, c)integral of polynomial ‘p’

  • Example: Poly_10.mc 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.mp is characteristic polynomial

Mathematical Modeling and Simulation

3


Interpolation and curve fitting

  • 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

    • interp3

    • interp1q, %it is quicker than ‘interp1’ on non-uniformly

    • spaced data because it does no input checking

    • interpft,

    • interpn

Mathematical Modeling and Simulation

4


Interpolation and curve fitting

  • 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

    • griddataExample:RandomDataInterp_04

Mathematical Modeling and Simulation

5


Interpolation and curve fitting

  • 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

Mathematical Modeling and Simulation

6


Interpolation and curve fitting

Colormap

Mathematical Modeling and Simulation

7


Interpolation and curve fitting

Test Matrices:

binomial cauchy chebspec chebvand

chow circul clement compar

condex cycol dorr dramadah

fiedler forsythe frankgearmat

gcdmat grcar hanowa house

invhess invol ipjfact jordbloc

kahan kms krylovlauchli

lehmer leslie lesp lotkin

minij moler neumann orthog

parter pei poisson prolate

randcolu randcorr randhessrandjorth

rando randsvd redheff riemann

ris smoke toeppd tridiag

triw wathen wilk

A=gallery(‘binomial’, n)

Mathematical Modeling and Simulation

8


Interpolation and curve fitting

End

Mathematical Modeling and Simulation

9


  • Login