Re: Unwrap list of angles
- To: mathgroup at smc.vnet.net
- Subject: [mg73291] Re: [mg73262] Unwrap list of angles
- From: gardyloo <gardyloo at mail.wsu.edu>
- Date: Fri, 9 Feb 2007 23:39:28 -0500 (EST)
- References: <200702090718.CAA18382@smc.vnet.net>
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] :=
Module[{newTest,
lC =
Mod[
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:{{_,_}..} ]:=
Transpose[
{
list[[All, 1]],
UnwrapPhase[list[[All,-1]]]
}
]
Hope that helps!
C.O.
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 mail.remove_this.wsu.and_this.edu
PGP Key ID: 0x088E6D7A
Please avoid sending me Word or PowerPoint attachments
See http://www.gnu.org/philosophy/no-word-attachments.html
==========================================================
- References:
- Unwrap list of angles
- From: "ben" <benjamin.friedrich@gmail.com>
- Unwrap list of angles