Home > mml > at > getnusympmat.m

getnusympmat

PURPOSE ^

GETNUSYMPMAT - Calculate the tune from a symplectic one-turn matrix

SYNOPSIS ^

function nu = getnusympmat(M44)

DESCRIPTION ^

GETNUSYMPMAT - Calculate the tune from a symplectic one-turn matrix
  nu = getnusympmat(M44)

  INPUTS
  1. M44 - 4 by 4 symplectic matrix

  OUTPUTS
  1. nu - Tunes

  Written by Johan Bengtsson

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function nu = getnusympmat(M44)
0002 %GETNUSYMPMAT - Calculate the tune from a symplectic one-turn matrix
0003 %  nu = getnusympmat(M44)
0004 %
0005 %  INPUTS
0006 %  1. M44 - 4 by 4 symplectic matrix
0007 %
0008 %  OUTPUTS
0009 %  1. nu - Tunes
0010 %
0011 %  Written by Johan Bengtsson
0012 
0013 if nargin < 1
0014     global THERING
0015     M44 = findm66(THERING);
0016 end
0017 
0018 n = 4;
0019 
0020 M = M44(1:4, 1:4);
0021 M = M - eye(4); detp = det(M); M = M + 2*eye(4); detm = det(M); M = M - eye(4);
0022 b = (detp-detm)/16.0; c = (detp+detm)/8.0 - 1.0;
0023 th = (M(1, 1)+M(2, 2))/2.0; tv = (M(3, 3)+M(4, 4))/2.0;
0024 b2mc = b^2 - c;
0025 if b2mc < 0.0
0026     nu = [-1.0; -1.0];
0027     disp('** Getnu: unstable in tune');
0028 else
0029     if (th > tv)
0030         sgn = 1.0;
0031     else
0032         sgn = -1.0;
0033     end
0034     nu = [acos(sgn*sqrt(b2mc)-b)/(2.0*pi); acos(-b-sgn*sqrt(b2mc))/(2.0*pi)];
0035     for i = 1:n/2
0036         j = 2*i - 1;
0037         if (M(j,j+1) < 0.0)
0038             nu(i) = 1.0 - nu(i);
0039         end
0040     end
0041 end

Generated on Mon 21-May-2007 15:29:18 by m2html © 2003