[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unwrap modulo 2pi
> email@example.com wrote:
> > My appologies for not being explicit enough...
> > IDL> a=[2,4,6,8,10,12]
> > IDL> a=[2.,4.,6.,8.,10.,12.]
> > IDL> b=2*!PI
> > IDL> c=a mod b
> > IDL> print, c
> > 2.00000 4.00000 6.00000 1.71681 3.71681 5.71681
> > What I mean by 'unwraping' is: Given I know 'c' and 'b' how do I
> > explicitly find a?
> Surely I must be missing something(?):
> IDL> print, c + fix(a/b)*b
> 2.00000 4.00000 6.00000 8.00000 10.0000 12.0000
And a proverbial ohnosecond later I went - "Oh No!". I guess I better
go back to lurking. ;-(
Btw, given that (a mod b) = (a+(n*b) mod b) do you expect your 'unwraping'
function to give the lowest value of a such that c = a mod b?