Does anyone here use MATLAB ?

Discussion in 'Computer Science & Culture' started by Success_Machine, Jan 21, 2003.

Thread Status:
Not open for further replies.
  1. Success_Machine Impossible? I can do that Registered Senior Member

    Messages:
    365
    I have a set of (x,y) points on the interval [-1,1] and I need to use the InterpN function in MATLAB to generate a global curve fit (Newton interpolation) and graph the results. But I can't figure it out. Any experts out there?
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. ElectricFetus Sanity going, going, gone Valued Senior Member

    Messages:
    18,523
    YES I DO! Could you post your code so i could run it and see what is going wrong? what version are you running there? I have been using Matlab 6 R12 Professional. If you have the student version InterpN might not work.
     
    Last edited: Jan 24, 2003
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. Success_Machine Impossible? I can do that Registered Senior Member

    Messages:
    365
    I'm just trying to figure out how InterpN works period ! Could you give me an example?
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. ElectricFetus Sanity going, going, gone Valued Senior Member

    Messages:
    18,523
    Did you read about it in the help navigator?

    Seems to work when I follow this instructions:

    ****** Copied from help navigator ******

    interpn
    Multidimensional data interpolation (table lookup)

    Syntax
    VI = interpn(X1,X2,X3,...,V,Y1,Y2,Y3,...)
    VI = interpn(V,Y1,Y2,Y3,...)
    VI = interpn(V,ntimes)
    VI = interpn(...,method)
    Description
    VI = interpn(X1,X2,X3,...,V,Y1,Y2,Y3,...) interpolates to find VI, the values of the underlying
    multidimensional function V at the points in the arrays Y1, Y2, Y3, etc. For an N-D V, interpn is called with
    2*N+1 arguments. Arrays X1, X2, X3, etc. specify the points at which the data V is given. Out of range values
    are returned as NaNs. Y1, Y2, Y3, etc. must be arrays of the same size, or vectors. Vector arguments that are
    not the same size, and have mixed orientations (i.e. with both row and column vectors) are passed through
    ndgrid to create the Y1, Y2, Y3, etc. arrays. interpn works for all N-D arrays with 2 or more dimensions.

    VI = interpn(V,Y1,Y2,Y3,...) interpolates as above, assuming X1 = 1:size(V,1), X2 =
    1:size(V,2), X3 = 1:size(V,3), etc.

    VI = interpn(V,ntimes) expands V by interleaving interpolates between each element, working recursively
    for ntimes iterations. interpn(V,1) is the same as interpn(V).

    VI = interpn(...,method) specifies alternative methods:


    'linear'


    Linear interpolation (default)


    'cubic'


    Cubic interpolation


    'spline'


    Cubic spline interpolation


    'nearest'


    Nearest neighbor interpolation

    Discussion
    All the interpolation methods require that X1,X2, and X3 be monotonic and have the same format ("plaid") as if
    they were created using ndgrid. X1,X2,X3,... and Y1, Y2, Y3, etc. can be non-uniformly spaced. For faster
    interpolation when X1, X2, X3, etc. are equally spaced and monotonic, use the methods '*linear', '*cubic', or
    '*nearest'.

    See Also
    interp1, interp2, interp3, ndgrid
     
Thread Status:
Not open for further replies.

Share This Page