source: ETALON/CLIO/Analysis/ProfileX.m @ 715

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