Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5633

Re: Fitting step function

From Jacopo Bertolotti <jacopo.bertolotti@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Fitting step function
Date 2011-10-14 09:53 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j790rg$i0m$1@smc.vnet.net> (permalink)
References <201110120744.DAA16264@smc.vnet.net>

Show all headers | View raw


Maybe I totally misunderstood your point but, if you really want to know 
where the phase jumps (likely phase wraps) happen, wouldn't be a lot 
easier to just look when the difference between two adjacent points is 
bigger than Pi or something like that?

Here is an example code (sorry, it is not easily readable but I hope it 
makes my point clear):
phasedata = Table[Arg[Exp[I x^2]], {x, 0, 10, 0.01}];  (*any phase data. 
Here I am just faking some.*)
jumps = Drop[ Flatten@Position[Round[Differences[phasedata]/(2 Pi)], 
Except[0]], 1];  (*find those points whose difference with the previous 
one is approximately a multiple of 2 Pi. There is a spurious 0 that is 
eliminated with the Drop command. *)
jumps = Table[{jumps[[i]], 0}, {i, 1, Dimensions[jumps][[1]]}];  (* give 
the coordinates a y value just for the sake of plotting *)
ListPlot[phasedata, Joined -> True, Epilog -> {PointSize[Medium], Red, 
Map[Point, jumps]}] (*It works!!!*)

Regards

Jacopo

On 10/12/2011 09:44 AM, premiumxy 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!
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Fitting step function Jacopo Bertolotti <jacopo.bertolotti@gmail.com> - 2011-10-14 09:53 +0000

csiph-web