Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Plot function at specific points

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114156] Re: Plot function at specific points
  • From: "Carl K. Woll" <carlw at wolfram.com>
  • Date: Thu, 25 Nov 2010 05:59:20 -0500 (EST)

On 11/24/2010 6:00 AM, Istv=E1n Zachar wrote:
> Dear Bob,
>
> sadly, the variable 'data' is not available for me, only the
> InterpolationFunction, that was initially created for a multitude of
> coordinates.

Perhaps you can use the following to extract this 'data':

In[53]:== if==Interpolation[{{1,2},{2,4},{3,6},{4,9}}]
Out[53]== InterpolatingFunction[{{1,4}},<>]
In[54]:== if["Coordinates"]
Out[54]== {{1,2,3,4}}
In[55]:== if["Grid"]
Out[55]== {{1},{2},{3},{4}}
In[56]:== if["ValuesOnGrid"]
Out[56]== {2,4,6,9}

Carl Woll
Wolfram Research

> That's why I cannot extract data directly, but has to specify a tricky
> "method to use for refining curves" inside Plot, i.e. the Method option.
> Even more sad is that NOTHING can be found about the possible values of
> Method in the documentation for either Plot or ParametericPlot. As it is
> the case usually with Method...
>
> Istvan
>
> On 2010.11.23. 13:51, Bob Hanlon wrote:
>> You can use InterpolationOrder to control the resolution.
>>
>> data ==== {{0, 1}, {1, 2}, {2, 3}, {3, 5},
>>      {4, 8}, {5, 5}, {6, 2}, {7, 1},
>>      {8, 1}, {9, 2}, {10, 4}};
>>
>> Partition[
>>     Table[
>>      Plot[
>>       Interpolation[data, InterpolationOrder ->   n][x],
>>       {x, 0, 10},
>>       PlotRange ->   {{0, 10}, {0, 9}},
>>       ImageSize ->   288],
>>      {n, 0, 3}],
>>     2] // Grid
>>
>> lowRes ==== Range[0, 10, 2];
>>
>> Show[
>>    ListLinePlot[{#, f@#}&   /@ lowRes,
>>     PlotStyle ->   Blue],
>>    Plot[
>>     Interpolation[data, InterpolationOrder ->   1][x],
>>     {x, 0, 10},
>>     PlotStyle ->   Red],
>>    PlotRange ->   {{0, 10}, {0, 9}},
>>    ImageSize ->   500,
>>    Epilog ->   {AbsolutePointSize[6], Green,
>>      Point[data]}]
>>
>>
>> Bob Hanlon
>>
>> ---- "Istv==C3==A1n Zachar"<zac at freemail.hu>   wrote:
>>
>> ====================================================
>> Dear Group,
>>
>> is there a method to plot an InterpolatingFunction at specific pointr
>> WITHIN Plot? I am of course aware that I can use ListPlot at any time,
>> though for certain reasons I have to stick with Plot. The main reason
>> is that I have a large amount of InterpolatingFunctions which I plot
>> with Plot as default, though at request I have to plot the same
>> InterpolatingFunctions at different resolutions. PlotPoints and
>> MaxRecursion is no good here, since lower resolution has to use a
>> certain set of x-values, defined prior to plotting. Obviously I want
>> to use the same Plot setup for both high and low-resolution cases.
>> Below is a toy modell of the problem:
>>
>> f ==== Interpolation[{{0, 1}, {1, 2}, {2, 3}, {3, 5}, {4, 8}, {5, 5}, {6=
,
>> 2}, {7, 1}, {8, 1}, {9, 2}, {10, 4}}];
>> lowRes ==== Range[0, 10, 2];
>> Plot[f[x], {x, 0, 10}, PlotRange ->   {{0, 10}, {0, 9}}]
>> ListLinePlot[{#, f@#}&   /@ lowRes, PlotRange ->   {{0, 10}, {0, 9}}]
>>
>> Again, what I want is to have a specific Plot call instead of the
>> ListLinePlot, but with same result as ListLinePlot.
>> Note that values of 'lowRes' may not correspond the exact x-
>> coordinates supplied to f.
>>
>> Is there a way to tell Plot explicitly the steps to use? Any idea?
>>
>> Istvan
>>
>>
>>


  • Prev by Date: Re: Plot function at specific points
  • Next by Date: Re: Mathematica 8: first impressions
  • Previous by thread: Re: Plot function at specific points
  • Next by thread: [Question] NonlinearRegress with two independent variables.