Re-scaling matrix entries to lie within a range
Mostrar comentarios más antiguos
Hey all,
Basically, I have a matrix containing a wide range of phase angles, but I want to re-scale all these angles to their equivalent values within the range [-pi, pi]. Hence, for example, 1.5*pi will become -0.5*pi.
Would anyone have any tips on how to do this? I'm not looking for a full answer; merely any suggestions that would help me get started would be much appreciated!
Craig
Respuesta aceptada
Más respuestas (2)
Walter Roberson
el 22 de Nov. de 2011
mod(angle + pi, 2*pi) - pi
Note: this will produce the range semi-open interval [-pi, pi) . The original closed interval [-pi, pi] is ambiguous as to what -pi or pi exactly should map to (as they are the same angle)
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!