MathGroup Archive 2011

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

Search the Archive

Re: Interpolation of a tabulated function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115603] Re: Interpolation of a tabulated function
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sun, 16 Jan 2011 05:52:25 -0500 (EST)

That throws a warning, but this does not:

x = RandomReal[{0, 10}, {20}];(*Generate random x*)data =
  Transpose[{x, x^2}] (*The function is now y=x^2*)

intFunc = Interpolation[data];

Show[ListPlot[data], Quiet@Plot[intFunc[x], {x, 0, 10}]]

or this:

x = RandomReal[{0, 10}, {20}];(*Generate random x*)data =
  Transpose[{x, x^2}] (*The function is now y=x^2*)
{min, max} =
  Through[{Min, Max}@data[[All, 1]]]

intFunc = Interpolation[data];

Show[ListPlot[data], Plot[intFunc[x], {x, min, max}]]

Bobby

On Sat, 15 Jan 2011 03:44:30 -0600, Gabriel Landi <gtlandi at gmail.com>  
wrote:

> Sorry if I misunderstood the problem but would it be something like the
> following?
>
> x=RandomReal[{0,10},{20}]; (*Generate random x*)
>
> data=Transpose[{x,x^2}] (*The function is now y=x^2*)
>
> intFunc=Interpolation[data];
>
> Show[ListPlot[data],Plot[intFunc[x],{x,0,10}]]
>
> It worked over here
> Hope it helps,
>
> Gabriel
>
> On Fri, Jan 14, 2011 at 9:16 AM, girl17 <irexxy at gmail.com> 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?
>>
>>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: Apply or Map on some parts of lists - help
  • Next by Date: Help on compiling a function
  • Previous by thread: Re: Interpolation of a tabulated function
  • Next by thread: NETLink problem on W2008 Server