MathGroup Archive 2007

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

Search the Archive

Re: Unwrap list of angles

  • To: mathgroup at
  • Subject: [mg73291] Re: [mg73262] Unwrap list of angles
  • From: gardyloo <gardyloo at>
  • Date: Fri, 9 Feb 2007 23:39:28 -0500 (EST)
  • References: <>

Hi, Ben,

   I ended up writing a version of this a while ago. Here's the 
definition I use. The first is for a list of one dimension; it's used in 
the second definition (since I usually deal with lists of two dimensions 
where the second element in the ordered pairs is the phase.

UnwrapPhase[list_ /; Length[Dimensions[list]] == 1] :=


          lC = 


                   ListCorrelate[{-1, 1}, list], Pi, -Pi/2]}, newTest[1] = list[[1]];

    newTest[i_] := newTest[i] = newTest[i - 1] + lC[[i - 1]];

    newTest[#] & /@ Range[Length[list]]]

UnwrapPhase[list:{{_,_}..} ]:=



      list[[All, 1]],




   Hope that helps!


ben wrote:
> Dear all
> I am looking for a Mathematica-analogue of the unwrap function in another system:
> I have a list of angles and want to add multiples of 2*pi to them, so
> that there
> are no 'jumps' between subsequent entries.
> Is there a ready-made function?
> Bye
> Ben

Curtis Osterhoudt          
gardyloo at
PGP Key ID: 0x088E6D7A
Please avoid sending me Word or PowerPoint attachments

  • Prev by Date: FindFit and NonlinearRegress: Advantages/Disadvantages?
  • Next by Date: Re: Would someone confirm they also see this problem?
  • Previous by thread: Re: Unwrap list of angles
  • Next by thread: Plot n sets of 2D data in 3D