source: ETALON/CLIO/Analysis/Data19July/ProfileX.m @ 723

Last change on this file since 723 was 723, checked in by hodnevuc, 7 years ago
File size: 3.9 KB
Line 
1close all; clear all; clc
2load FFX.mat
3cd('./KK')
4
5for c=[1:7]%, 14:18
6    c
7% for c=1:20
8% SP=flip(Freq([3:4, 6:end-1]));
9% SS(c,:)=flip(FF(c,[3:4, 6:end-1]))/9/5/3;
10 SP=flip(Freq([3:6 8:end-1]));
11 SS(c,:)=flip(FF(c,[3:6 8:end-1]))/9/5/1.5;
12% SSM(c)=max(SS);
13[RSP,ISP(c,:)]=SRf(SP,SS(c,:));
14%
15
16% figure (1)
17% plot(SP,SS(c,:),'or')
18% hold on
19%  plot(RSP)
20
21 PhaseH=-(imag(hilbert(log(abs(RSP)))));
22RPH=real((ifft(RSP.*exp(1i.*(PhaseH)))));
23
24
25% figure(2)
26[mx,ps]=max(RPH)
27 RPH= [zeros(1,230-ps), RPH(1:end-(230-ps))]
28%  plot((1:length(RPH))*1e-9/length(RPH),RPH)
29
30Gauss=@(mu,sig,A,x)A.*exp(-(x-mu).^2/(2*sig^2))
31% hold on
32%2.1e-12
33Profile5=Gauss(ps*1e-9/length(RPH),2.1e-12,mx,(1:length(RPH))*1e-9/length(RPH));
34% plot((1:length(RPH))*1e-9/length(RPH),Profile5,'r')
35 FWHM(c)=sum(RPH>max(RPH)/2)*1e-9/length(RPH)
36  FW01M(c)=sum(RPH>max(RPH)*0.1)*1e-9/length(RPH)
37 FW09M(c)=sum(RPH>max(RPH)*0.9)*1e-9/length(RPH)
38
39 
40PR(c,:)=RPH;
41sum(Profile5>max(Profile5)/2)*1e-9/length(Profile5)
42% figure(1)
43% plot(abs(fft(RPH)),'r')
44% plot(abs(fft(Profile5./sum(Profile5))),'k')
45
46 end
47Bphase=sort([5.84 5.74 5.64 5.54 5.44 5.94 6.04]);
48
49% ds=1:20;
50 figure
51 hold on
52plot(Bphase,FW01M(:)*1e+12,'->k','linewidth',2)
53plot(Bphase,FWHM(:)*1e+12,'->b','linewidth',2)
54plot(Bphase,FW09M(:)*1e+12,'->r','linewidth',2)
55
56 set(gca,'fontsize',16)
57  xlabel('\phi_B, [a.u.]')
58 ylabel('Pulsewidth, [ps]')
59 legend('FW0.1M','FWHM','FW0.9M','Orientation','horizontal')
60 grid on
61 title('Pulsewidth vs. Buncher phase')
62 
63figure
64[hc hc]=contourf((1:length(RPH))*1e-9/length(RPH)*1e+12,Bphase,PR*500)
65colorbar
66  set(hc,'LineStyle','none');
67xlim([10 50])
68 set(gca,'fontsize',16)
69
70 xlabel('Time, [ps]')
71 ylabel('\phi_B, [a.u.]')
72 title('Bunch profile')
73 
74 
75 figure
76 
77 hold on
78plot(SP,  SS(2,:),'ob','linewidth',2)
79plot(0:(length(ISP)-1),  ISP(2,:),'-.b','linewidth',2)
80plot(SP,  SS(4,:),'om','linewidth',2)
81plot(0:(length(ISP)-1),  ISP(4,:),'-.m','linewidth',2)
82plot(SP,  SS(6,:),'ok','linewidth',2)
83plot(0:(length(ISP)-1),  ISP(6,:),'-.k','linewidth',2)
84plot(SP,  SS(1,:),'og','linewidth',2)
85plot(0:(length(ISP)-1),  ISP(1,:),'-.g','linewidth',2)
86plot(SP,  SS(3,:),'or','linewidth',2)
87plot(0:(length(ISP)-1),  ISP(3,:),'-.r','linewidth',2)
88
89 set(gca,'fontsize',16)
90 xlabel('Frequency, [GHz]')
91 legend('\phi_B=5.84','\phi_B=5.74','\phi_B=5.54','\phi_B=5.44','\phi_B=6.04')
92 % 2 4 6 8 10
93 title('Form Factor (BGS=10 mm)')
94ylabel('Amplitude, [a.u.]')
95xlim([0, 300])
96grid on
97 
98  figure
99 
100 hold on
101plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(1,:)*500,'-.b','linewidth',2)
102plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(3,:)*500,'-.m','linewidth',2)
103plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(5,:)*500,'-.k','linewidth',2)
104plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(2,:)*500,'-.g','linewidth',2)
105plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(7,:)*500,'-.r','linewidth',2)
106
107 set(gca,'fontsize',16)
108 xlabel('Time, [ps]')
109 legend('\phi_B=5.84','\phi_B=5.64','\phi_B=5.44','\phi_B=5.74','\phi_B=6.04')
110 % 2 4 6 8 10
111 title('Reconstructed profile')
112ylabel('Amplitude, [a.u.]')
113xlim([0, 50])
114grid on
115 
116%   
117%   figure
118
119%  hold on
120% plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(5,:)*500,'-.b','linewidth',2)
121% plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(6,:)*500,'-.m','linewidth',2)
122% plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(7,:)*500,'-.k','linewidth',2)
123% plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(2,:)*500,'-.g','linewidth',2)
124% plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(1,:)*500,'-.r','linewidth',2)
125%
126%  set(gca,'fontsize',16)
127%  xlabel('Time, [ps]')
128%  legend('\phi_B=8.14','\phi_B=8.19','\phi_B=8.24','\phi_B=5.54','\phi_B=5.44')
129%  % 2 4 6 8 10
130%  title('Reconstructed profile')
131% ylabel('Amplitude, [a.u.]')
132% xlim([0, 50])
133% grid on
134
135%  Bphase=sort([5.84 5.74 5.64 5.54 5.44 5.94 6.04]);
136%
137%  time =(0:(length(RPH)-1))*1e-9/length(RPH)*1e+9;%ns
138%  Profile=PR(6,:)*500;
139
140% %  save P6.mat time Profile
141 
142 
143 
144 
145 
146 
147 
148 
149 
150 
151 
152 
153 
154 cd('..')
Note: See TracBrowser for help on using the repository browser.