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

Re: unwrap modulo 2pi



Thank you! This is very close to what I want.  Would you mind
posting the function 'nint' as well?

GW

In article <3A826338.62364176@iri.tudelft.nl>,
  "Wim G. Bouwman" <w.g.bouwman@iri.tudelft.nl> wrote:
> In the following bit of code the measured phase P is unwrapped onto
> CALCPhi.
> This is done by doing a 2nd order extrapolation of the three previous
> points.  It works when the jumps are not too extreme.
>
> ;Correct Phi and PhiOne for 2Pi jumps. The calculated Phi is compared
to
> ;the experimentally obtained Phi. Extrapolation with least squares
fit.
> NPhi=N_ELEMENTS(P)
> CALCphi=DBLARR(NPhi)
> FOR i=3,(NPhi-1) DO BEGIN
>  CALCphi(i)=(-2*P(i-3)+P(i-2)+4*P(i-1))/3
>  Njumps=NINT((CALCphi(i)-P(i))/(2*!DPi), /Long)
>  P(i)=P(i)+Njumps*2*!DPi
> ENDFOR
>


Sent via Deja.com
http://www.deja.com/