source: ETALON/CLIO/Analysis/Data24May/ProfileXBP.m @ 719

Last change on this file since 719 was 719, checked in by hodnevuc, 7 years ago
File size: 3.1 KB
Line 
1close all; clear all; clc
2load FFXBP.mat
3cd('./KK')
4
5for c=1:6%, 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)=sum(RPH>max(RPH)/2)*1e-9/length(RPH)
34  FW01M(c)=sum(RPH>max(RPH)*0.1)*1e-9/length(RPH)
35 FW09M(c)=sum(RPH>max(RPH)*0.9)*1e-9/length(RPH)
36
37 
38PR(c,:)=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=[2.4 2.2 2.0 1.8 1.6 1.4 1.2];
46
47% ds=1:20;
48 figure
49 hold on
50plot(Bphase(1:6),FW01M(:)*1e+12,'->k','linewidth',2)
51plot(Bphase(1:6),FWHM(:)*1e+12,'->b','linewidth',2)
52plot(Bphase(1:6),FW09M(:)*1e+12,'->r','linewidth',2)
53
54 set(gca,'fontsize',16)
55  xlabel('Buncher power, [a.u.]')
56 ylabel('Pulsewidth, [ps]')
57 legend('FW0.1M','FWHM','FW0.9M','Orientation','horizontal')
58 grid on
59 title('Pulsewidth vs. Buncher power')
60 
61figure
62[hc hc]=contourf((1:length(RPH))*1e-9/length(RPH)*1e+12,Bphase(1:6),PR*500)
63colorbar
64  set(hc,'LineStyle','none');
65xlim([0 50])
66 set(gca,'fontsize',16)
67
68 xlabel('Time, [ps]')
69 ylabel('Buncher power, [a.u.]')
70 title('Bunch profile')
71 
72 
73 figure
74 
75 hold on
76plot(SP,  SS(1,:),'ob','linewidth',2)
77plot(0:(length(ISP)-1),  ISP(1,:),'-.b','linewidth',2)
78plot(SP,  SS(2,:),'om','linewidth',2)
79plot(0:(length(ISP)-1),  ISP(2,:),'-.m','linewidth',2)
80plot(SP,  SS(3,:),'ok','linewidth',2)
81plot(0:(length(ISP)-1),  ISP(3,:),'-.k','linewidth',2)
82plot(SP,  SS(4,:),'og','linewidth',2)
83plot(0:(length(ISP)-1),  ISP(4,:),'-.g','linewidth',2)
84plot(SP,  SS(5,:),'or','linewidth',2)
85plot(0:(length(ISP)-1),  ISP(5,:),'-.r','linewidth',2)
86
87 set(gca,'fontsize',16)
88 xlabel('Frequency, [GHz]')
89 legend('BP=2.4','','BP=2.2','','BP=2.0','','BP=1.8','','BP=1.6','')
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(2,:)*500,'-.m','linewidth',2)
101plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(3,:)*500,'-.k','linewidth',2)
102plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(4,:)*500,'-.g','linewidth',2)
103plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(5,:)*500,'-.r','linewidth',2)
104plot((0:(length(RPH)-1))*1e-9/length(RPH)*1e+12,  PR(6,:)*500,'-.y','linewidth',2)
105
106 set(gca,'fontsize',16)
107 xlabel('Time, [ps]')
108 legend('BP=2.4','BP=2.2','BP=2.0','BP=1.8','BP=1.6','BP=1.4')
109 % 2 4 6 8 10
110 title('Reconstructed profile')
111ylabel('Amplitude, [a.u.]')
112xlim([0, 50])
113grid on
114 
115 
116 
117 
118 time =(0:(length(RPH)-1))*1e-9/length(RPH)*1e+9;%ns
119 Profile=PR(3,:)*500;
120 
121 save P6BP.mat time Profile
122 
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 cd('..')
Note: See TracBrowser for help on using the repository browser.