MathGroup Archive 1993

[Date Index] [Thread Index] [Author Index]

Search the Archive

interpolation of unevenly sampled points

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: interpolation of unevenly sampled points
  • From: nb at cs.stanford.edu
  • Date: Sat, 23 Jan 93 15:50:40 PST

Hi,

> All I need is a way to resample a set of  numbers at specific  
> intervals.  Each x has a corresponding y, but the x's are not evenly  
> spaced.  I'd like to space them evenly (so I can plot a surface using  
> Mathematica), using some simple interpolation algorithm.  I'd write a  
> routine myself, but the problems sounds so common I thought someone  
> may already have written it.  However, nothing this simple appears to  
> exist on the Mathematica archive server.

Fit can handle unevenly spaced points, so no need to reinvent the wheel.

Fit[data, funs, vars] finds a least-squares fit to a list
   of data as a linear combination of the functions funs
   of variables vars. The data can have the form {{x1, y1,
   ..., f1}, {x2, y2, ..., f2}, ...}, where the number of
   coordinates x, y, ... is equal to the number of
   variables in the list vars. The data can also be of the
   form {f1, f2, ...}, with a single coordinate assumed to
   take values 1, 2, .... The argument funs can be any
   list of functions that depend only on the objects vars.

In[2]:= Fit[{{2,4.7}, {5, 3.4}, {11, 5.6}, {12, 32.7}}, {1, x, x^2}, x]

Out[2]=
                                2
18.8197 - 7.23175 x + 0.639707 x

Nancy






  • Prev by Date: Re: Series is taking too long
  • Next by Date: Applying a set of rules to a List
  • Previous by thread: Re: interpolation of unevenly sampled points
  • Next by thread: SphericalPlot3D