0001 function plot_spectrum_from_launch_jd(launch,xlim,p_opt,select)
0002
0003 if nargin < 4,
0004 select = struct;
0005 end
0006
0007 if nargin < 3,
0008 p_opt = -1;
0009 end
0010
0011 if nargin < 2,
0012 xlim = NaN;
0013 end
0014
0015 if isfield(select,'style'),
0016 style = select.style;
0017 else
0018 style = struct;
0019 end
0020
0021 if isfield(launch,'yrho0'),
0022 yN = launch.yNpar0;
0023 ydN = launch.ydNpar0;
0024 yP = launch.yP0_2piRp*2*pi*launch.Rp/1e6;
0025
0026 if isfield(launch,'launch'),
0027 yN0 = launch.launch.bNpar0;
0028 ydN0 = launch.launch.bdNpar0;
0029 yP0 = launch.launch.bPlhtot/1e6;
0030 else
0031 yN0 = NaN;
0032 ydN0 = NaN;
0033 yP0 = NaN;
0034 end
0035
0036 else
0037 yN = launch.bNpar0;
0038 ydN = launch.bdNpar0;
0039 yP = launch.bPlhtot/1e6;
0040 end
0041
0042 ny = length(yN);
0043
0044 dx = min(ydN)/10;
0045 x = (min(yN) - 4*max(ydN)):dx:(max(yN) + 4*max(ydN));
0046 nx = length(x);
0047
0048 xyN = repmat(yN,[nx,1]);
0049 xyP = repmat(yP,[nx,1]);
0050 xydN = repmat(ydN,[nx,1]);
0051 xy = repmat(x.',[1,ny]);
0052
0053 xyf = xyP.*exp(-(xy - xyN).^2./xydN.^2)./sqrt(pi)./xydN;
0054 xf = sum(xyf,2);
0055
0056 if isfield(launch,'yrho0'),
0057 ny0 = length(yN0);
0058
0059 dx0 = min(ydN0)/10;
0060 x0 = (min(yN0) - 4*max(ydN0)):dx:(max(yN0) + 4*max(ydN0));
0061 nx0 = length(x0);
0062
0063 xyN0 = repmat(yN0,[nx0,1]);
0064 xyP0 = repmat(yP0,[nx0,1]);
0065 xydN0 = repmat(ydN0,[nx0,1]);
0066 xy0 = repmat(x0.',[1,ny0]);
0067
0068 xyf0 = xyP0.*exp(-(xy0 - xyN0).^2./xydN0.^2)./sqrt(pi)./xydN0;
0069 xf0 = sum(xyf0,2);
0070 end
0071
0072 if isfield(select,'axs'),
0073 ax = select.axs(1);
0074 set(ax,'Visible','on');
0075 red = 1;
0076 lspace = NaN;
0077 bspace = NaN;
0078 else
0079 if isfield(launch,'yrho0'),
0080 fig1 = figure('Name','Tail power spectrum');
0081 else
0082 fig1 = figure('Name','Gaussian fit vs. ALOHA');
0083 end
0084 ax = gca;
0085 red = 0.9;
0086 lspace = 0.7;
0087 bspace = 0.5;
0088 end
0089
0090 if isfield(launch,'yrho0'),
0091 graph1D_jd(x0,xf0,0,0,'n_{||}','dP/dn_{||} (MW)',strrep(launch.id,'_','-'),NaN,xlim,NaN,'-','none','b',2,style,ax,red,lspace,bspace);
0092 graph1D_jd(x,xf,0,0,'n_{||}','dP/dn_{||} (MW)',strrep(launch.id,'_','-'),NaN,xlim,NaN,'-','none','r',2,style,ax,red,lspace,bspace);
0093 legend(['Initial spectrum, P_{LH} = ',num2str(sum(yP0)),' (MW)'],['Tail spectrum, P_{LH} = ',num2str(sum(yP)),' (MW)'])
0094 else
0095 graph1D_jd(x,xf,0,0,'n_{||}','dP/dn_{||} (MW)',strrep(launch.id,'_','-'),NaN,xlim,NaN,'-','none','r',2,style,ax,red,lspace,bspace);
0096 legend(['Initial spectrum, P_{LH} = ',num2str(sum(yP)),' (MW)'])
0097 end
0098 graph1D_jd([0,0],get(gca,'ylim'),0,0,'','','',NaN,xlim,NaN,'-','none','k',2,style,ax);
0099 set(gca,'xtick',[-16:2:16])
0100
0101 print_jd(p_opt,['Fig_',launch.id,'_spectrum'],NaN,1);