MathGroup Archive 1998

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

Search the Archive

Re: Re: Want a smooth function from Arg[ ]



Daniel Lichtblau wrote:
> 
> Ryan Scott wrote:
> >
> > I need to be able to fit an nth degree polynomial to the phase function
> > for  a list of data.  However, the Arg[x] function wraps the phase at
> > +/- Pi  creating discontinuities in what would be a smooth function.
> > To clearify, let me give the following example:
> >
> > Create a list of data with a  gaussian profile and quadratic phase:
> >
> > nn=128;
> > a=0.005; b=0.003;
> > data=Table[N[Exp[-a*(t-nn/2)^2+I*b*(t-nn/2)^2]], {t,nn}];
> >
> > Plot the magnitude and phase:
> >
> > ListPlot[Abs[data],PlotRange->{0,1},PlotJoined->True,
> >   PlotLabel->FontForm[
> >       "Absolute value of waveform",{"Helvetica-Bold",10}]]
> > ListPlot[Arg[data], PlotJoined->True, PlotRange->All,
> >    PlotLabel->FontForm[ "Phase of time waveform",
> > {"Helvetica-Bold",10}]]
> >
> > I would like to now fit a curve to this phase (which should be 0.003*x^2
> > ).
> >  However, the wrapping of the phase would seem to make this difficult to
> > do  directly.  Any ideas on how to manipulate the results of Arg to
> > give a  continuous function of data?
> >
> > Thanks,
> >
> > Ryan
> >
> > --
> > ________________________________________________
> >
> >   Ryan P. Scott
> >   Laser and Electro-Optics Research Group
> >   UC Davis - Department of Applied Science
> >   Tel: (530)754-4358  Fax: (530)752-1652
> >   Email: scott@leorg.ucdavis.edu
> > ________________________________________________
> 
> One approach might be to renormalize the arguments. You can do this by
> comparing Arg[point] to Arg[previous point]. Any time you see a jump
> larger than, say, Pi, then shift successive arg values by Pi.
> 
> args = Arg[data];
> renormalize[args_] := Module[
>         {pairs, diffs, j, len=Length[args], corr=0},
>         pairs = Partition[args,2,1];
>         diffs = Map[#[[1]]-#[[2]]&,pairs];
>         PrependTo[diffs, 0];
>         diffs = 2*Pi*Sign[Chop[diffs,Pi]];
>         Table[
>                 corr += diffs[[j]];
>                 corr+args[[j]],
>                 {j,1,len}]
>         ]
> newargs = renormalize[args];
> ListPlot[newargs, PlotJoined->True, PlotRange->All,
>         PlotLabel->FontForm["Phase of time waveform"]]
> 
> This gives a smooth parabola as desired.
> 
> Daniel Lichtblau
> Wolfram Research


The method you gave works beautifully for continuous functions or for
smooth, discrete data.  If there is the possibility of noise in the
input function, then the problem becomes harder.  My own meeting of
this problem occurs in Fourier propagation of light.  The phase output
of an fft is totally chopped up for the same reason the Arg chops it
up.  I have had some success in minimizing the numerical first and
second derivatives, but it is far from a trivial problem, especially in
two dimensions.  If you hear of a different approach than an
after-the-fact hunting for discontinuities, please let me know.



  • Prev by Date: MathLink: C++ Programs on SunSolaris
  • Next by Date: Re: Redirecting output to file
  • Prev by thread: Re: Want a smooth function from Arg[ ]
  • Next by thread: Re: Want a smooth function from Arg[ ]