[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unwrap modulo 2pi

"Pavel A. Romashkin" <pavel.romashkin@noaa.gov> writes:

> I just don't see that you can do this at all. Modulo operator discards
> information about the number of multiples of B from A, leaving only the
> remainder of the division operation. For example, if:
... deleted ...
> Unless I am missing something, I see no way how a unique solution can be
> obtained from the *remainder of division* and *divisor*. But I studied
> arithmetics a long time ago :-)

Pavel, and others--

He is looking for an algorithm that can *reconstruct* the full number.
Of course this will use local information from the surrounding points. 

His example is perhaps a little too simple.  Try this one:

ph = findgen(100)
ph1 = atan(sin(ph), cos(ph))

Now, PH and PH1 represent the same phase angle on the circle, but PH1
has the disadvantage of being a discontinuous sawtooth function.
Sometimes you want to reconstruct PH based only on knowledge of PH1.
Assuming that the function is nearly monotonic and there is never a
phase jump more than !dpi, I believe this can be done.

The naive solution (which I've never gotten beyond) is to look for
discontinuities in PH1 of (say) more than !dpi.  When such a
discontinuity is found, assume we have wound around once, so add
another 2*!dpi to the number.


Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response