Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: How to find the kinks in a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104380] Re: How to find the kinks in a list
  • From: ADL <alberto.dilullo at tiscali.it>
  • Date: Thu, 29 Oct 2009 03:00:01 -0500 (EST)
  • References: <hc91oo$e4g$1@smc.vnet.net>

This might work:

data = ImportString["... your data ...",  "Table"];
{x, y} = Transpose[data];

(*finds the x corresponding to maximum y*)
maxPos[xli_?VectorQ, yli_?VectorQ] := xli[[Flatten[Position[yli, Max
[yli]]]]];

(*finds the x corresponding to minimum y*)
minPos[xli_?VectorQ, yli_?VectorQ] := xli[[Flatten[Position[yli, Min
[yli]]]]];

(*computes a balanced derivative*)
dd[x_] := ListCorrelate[Join[{-1}, Table[0, {1}], {1}]/2, x];

(*computes a 3-moving average*)
mm[x_] := MovingAverage[x, 3];

(*computes the second derivative*)
ddx = mm@mm@x;
ddy = dd@dd@y;

maxPos[ddx, ddy]
==> {1.51}

minPos[ddx, ddy]
==> {3.31}

ADL


On Oct 28, 10:09 am, Mather <sdzbb... at hotmail.com> wrote:
> Hi, all
>
> I want to get the two kinks in the following list, say, x=1.5 and 3.3
> by Mathematica.
> However I have no idea which command to employ.
> Can anyone help? Thanks in advance!
> ...


  • Prev by Date: Re: Rotating an Image
  • Next by Date: Re: Version 7 Virtual Book
  • Previous by thread: Re: How to find the kinks in a list
  • Next by thread: Re: How to find the kinks in a list