Re: Gradient of a List
- To: mathgroup at smc.vnet.net
- Subject: [mg82570] Re: [mg82557] Gradient of a List
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Thu, 25 Oct 2007 06:03:29 -0400 (EDT)
- References: <10340059.1193232789565.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
data = Table[{x + RandomReal[], Sin@x + 0.1 RandomReal[]}, {x, 0, Pi,
0.1}];
f = Interpolation[data, InterpolationOrder -> 3];
{min, max} = data[[Ordering[data][[{1, -1}]], 1]];
Quiet@Plot[f'[x], {x, min, max}, PlotRange -> All]
I use Quiet because Plot sometimes samples outside the data range and
throws the InterpolatingFunction::dmval message.
Notice, however, the result isn't even close to Cos[x], and it changes
quite a bit if you change the InterpolationOrder.
Bobby
On Wed, 24 Oct 2007 03:34:28 -0500, olalla <operez009 at ikasle.ehu.es> wrote:
> Hi everybody,
>
> Does anybody know how can I get the "gradient" of a list of points?
>
> My real problem is:
>
> I have a scalar field previously obtained numerically that for a
> given point (xi,yi) takes a value f(xi,yi). What I want to do is an
> estimation of the gradient of this scalar field BUT I haven't got any
> analytical function that expresses my field so I can't use the Grad
> function.
>
> How can I solve this using Mathematica?
>
> Thanks in advance
>
> Olalla, Bilbao UPV/EHU
>
>
--
DrMajorBob at bigfoot.com