       Re: Fitting step function

• To: mathgroup at smc.vnet.net
• Subject: [mg122099] Re: Fitting step function
• From: Barrie Stokes <Barrie.Stokes at newcastle.edu.au>
• Date: Fri, 14 Oct 2011 05:52:31 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <201110120744.DAA16264@smc.vnet.net>

```Hi premiumxy

I assume that when you say "...  to find the x-coordinates ..." you mean get an estimate with accompanying precision of the time of the 180 degree phase shift. You can do that by nonlinearly fitting various step or sigmoidal models; there are also Bayesian methods which would give you such a result in an intuitively satisfactory way.

With certain types of data or contexts, this is called intervention analysis.

If you have some data to share ...?

In the meantime (these are your ideas):

data = RandomReal[ {-5, 5}, {83} ]~Join~RandomReal[ {25, 35}, {200 - 83} ];

dataPlot = ListPlot[ data, Joined -> True ];

Off[ NonlinearModelFit::cvmit ]
nlm = NonlinearModelFit[data,
a ArcTan[ b (x - t)] + c, {{a, 20}, {b, 100}, {t, 50}, {c, 20}}, x ]

Normal[nlm]

solPlot = Plot[Normal[nlm], {x, 0, 200}, PlotStyle -> {Red, Thick}];

Show[ dataPlot, solPlot ]

nlm["ParameterTable"]

Step change is at:

{t /. nlm["BestFitParameters"],
\!\(\*SubscriptBox[\(nlm["\<ParameterConfidenceIntervals\>"]\), \(\(\
\[LeftDoubleBracket]\)\(3\)\(\[RightDoubleBracket]\)\)]\)}

Cheers

Barrie

>>> On 12/10/2011 at 6:44 pm, in message <201110120744.DAA16264 at smc.vnet.net>,
premiumxy <spam at stefanabel.com> wrote:
> Hello,
>
> I have the following problem: I have a set of data about some phase
> information of a signal. At certain points there is a clear step of 180
> degrees.
>
> I would like to fit this data to find the x-coordinates of these steps. I
> have the feeling that "normal" step-functions in Mathematica (such as
> UnitStep, HeavisideTheta, Sign...) are not varied in the fit-routines (such as
> NonlinearModelFit). I guess it this is caused by the functions not being
> continuous.
>
> I would appreciate any hints for this quite simple (?)problem. The only
> option that I can currently see is to create a "step-like" continuous function
> such as Tanh[A x] (with A>>1)
>
> Thanks!

```

• Prev by Date: Re: Fitting step function
• Next by Date: Re: Taking the Arg of a complex number
• Previous by thread: Re: Fitting step function
• Next by thread: Re: Fitting step function