Re: Interpolation of a tabulated function
- To: mathgroup at smc.vnet.net
- Subject: [mg115589] Re: Interpolation of a tabulated function
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sat, 15 Jan 2011 04:47:35 -0500 (EST)
On 1/14/11 at 6:16 AM, irexxy at gmail.com (girl17) wrote:
>So, I have a list for tabulated function like that:
>{{x1,y1},{x2,y2},...,{xn,yn}}, where x(i+1)-xi are not equal for all
>i. I want to get an interpolated function for that array and to use
>this function in this way: intFucn[x], where x1<=x<=xn. I tried to
>use ListInterpolation[], but it works only for 1D lists, i.e. in
>case if x(i+1)-xi are equal for all i. Is there any solution for
>this problem?
Use Interpolation. Note, the problem you are describing above is
a 1D problem. For this type of problem, the number of dimensions
is the number of coordinates needed to express the result. For
each input value x you have a single number y as the result,
making this a 1D problem.
ListInterpolation is not restricted to 1D lists. The following
taken from the documentation page for ListInterpolation works
just fine
f = ListInterpolation[
Table[Sin[x y], {x, 0, 1, .25}, {y, 0, 2, .25}], {{0, 1}, {0, 2}}]
Show[{Plot3D[f[x, y], {x, 0, 1}, {y, 0, 2}],
Graphics3D[{Red, PointSize[0.03],
Table[Point[{x, y, Sin[x y]}], {x, 0, 1, .25}, {y, 0, 2, .25}]}]}]