0001 function launch = main_launch_toray_jd(filename,omega_rf,P0,method);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 if nargin < 4,
0019 method = 1;
0020 end
0021
0022 launch.omega_rf = omega_rf;
0023
0024 if method == 1,
0025
0026
0027
0028 [ny] = textread(filename,'%n',1);
0029 [yX_L,yY_L,yZ_L,ybeta_L,yalpha_L] = textread(filename,'%n%n%n%n%n',ny+1);
0030
0031 yX_L = yX_L(2:ny+1).';
0032 yY_L = yY_L(2:ny+1).';
0033 yZ_L = yZ_L(2:ny+1).';
0034 ybeta_L = ybeta_L(2:ny+1).';
0035 yalpha_L = yalpha_L(2:ny+1).';
0036
0037 else
0038
0039
0040
0041 fid = fopen(filename);
0042 ny = fscanf(fid,'%d',1);
0043 for iray = 1:ny,
0044 raydata = fscanf(fid,'%f',5);
0045 yX_L(iray) = raydata(1);
0046 yY_L(iray) = raydata(2);
0047 yZ_L(iray) = raydata(3);
0048 ybeta_L(iray) = raydata(4);
0049 yalpha_L(iray) = raydata(5);
0050 end
0051 fclose(fid);
0052 end
0053
0054
0055
0056 yalpha_L(yalpha_L <= -180) = yalpha_L(yalpha_L <= -180) + 2*180;
0057 yalpha_L(yalpha_L > 180) = yalpha_L(yalpha_L > 180) - 2*180;
0058
0059 yX_L = yX_L/1e2;
0060 yY_L = yY_L/1e2;
0061 yZ_L = yZ_L/1e2;
0062 ybeta_L = ybeta_L*pi/180;
0063 yalpha_L = yalpha_L*pi/180;
0064
0065 yR_L = sqrt(yX_L.^2 + yY_L.^2);
0066 yX_L(yX_L == 0) = eps;
0067 yphi_L = atan(yY_L./yX_L) + pi*(yX_L < 0 & yY_L > 0) - pi*(yX_L < 0 & yY_L < 0);
0068
0069 launch.yR_L = yR_L;
0070 launch.yZ_L = yZ_L;
0071 launch.yphi_L = yphi_L;
0072 launch.yalpha_L = yalpha_L;
0073 launch.ybeta_L = ybeta_L;
0074
0075 launch.yP_L = P0/ny*ones(1,ny);
0076
0077
0078
0079
0080