source: ETALON/CLIO/Scripts/compare_distributions.m @ 759

Last change on this file since 759 was 759, checked in by delerue, 6 years ago

Control code for BPM added

File size: 2.1 KB
Line 
1figure(13)
2clf
3%%% Parameters
4for iprofile=[1 5 6]
5if (iprofile==1)
6pulse_len_ps=5
7epsl=1
8offset_gaussian=0
9amplitude_correction=1
10sigma_factor=1
11elseif (iprofile==2)
12pulse_len_ps=2.9
13epsl=1
14offset_gaussian=-0.0029
15amplitude_correction=0.6
16sigma_factor=1.2
17elseif (iprofile==3)
18pulse_len_ps=2
19epsl=1
20offset_gaussian=-0.004
21amplitude_correction=0.8
22sigma_factor=0.8
23elseif (iprofile==4)
24pulse_len_ps=3.2
25epsl=1
26offset_gaussian=-0.00245
27amplitude_correction=0.98
28sigma_factor=1.
29elseif (iprofile==5)
30pulse_len_ps=2.6
31epsl=1
32offset_gaussian=-0.0027
33amplitude_correction=0.8
34sigma_factor=1.
35elseif (iprofile==6)
36pulse_len_ps=2.
37epsl=1
38offset_gaussian=-0.0032
39amplitude_correction=0.8
40sigma_factor=1.
41end
42
43%%% Calcs
44sigma_t= pulse_len_ps/(sqrt(2*log(2))*(1+epsl))*1e-3;  %The sigma of the leading edge    ns
45sigma_D=sigma_t*sigma_factor
46nu=(1:1e+10:3e+16).*1e-9;%Ghz
47
48sigma_L= sigma_t*epsl;
49sigma_H= sigma_t;
50time=(1:(length(nu)*2))*(1/(length(nu)*2*(nu(2)-nu(1))));
51xc=mean(time);
52G1=exp(-(time-xc).^2./(2*sigma_L^2));
53G2=exp(-(time-xc).^2./(2*sigma_H^2));
54G3=amplitude_correction*exp(-(time-xc+offset_gaussian).^2./(2*sigma_D^2));
55G1nz=G1;
56G2nz=G2;
57G1(time>xc)=0;
58G2(time<xc)=0;
59
60%%% Dist
61ProfileG=(G1+G2)./sum(G1+G2);
62ProfileGG=(G1+G2+G3)./sum(G1+G2+G3);
63ProfileLN=(1./(time)).*exp(-(log(time-xc).^2)./(2*sigma_L^2));
64timeL=time-xc;
65xl=-0.045;
66ProfileL=(1./(sigma_t)).*(sigma_t.^2)*(1./((timeL-xl).^2+sigma_t^2));
67%ProfileLN=(1./((time*10+0.5))).*exp(-(log(((time*10+0.5))).^2)./(2*sigma_L^2));
68figure(1)
69clf
70hold on
71plot(time,ProfileG,'r')
72plot(time,ProfileGG,'m')
73%plot(time,ProfileL,'g')
74%plot(time,ProfileLN,'g')
75
76figure(11)
77clf
78hold on
79plot(time,G1nz./sum(G1+G2),':r')
80plot(time,G2nz./sum(G1+G2),'--r')
81plot(time,ProfileG,'r')
82figure(111)
83clf
84plot(time,ProfileG,'r')
85%figure(12)
86%clf
87%plot(time,ProfileL,'g')
88figure(13)
89hold on
90if (iprofile==1)
91plot(time,ProfileGG,'g')
92else
93plot(time,ProfileGG,'r')
94end
95
96%FWHM
97FWHMG=time(find(ProfileG>(max(ProfileG)/2),1,'last'))-time(find(ProfileG>(max(ProfileG)/2),1,'first'))
98FWHMGG=time(find(ProfileGG>(max(ProfileGG)/2),1,'last'))-time(find(ProfileGG>(max(ProfileGG)/2),1,'first'))
99end %for
Note: See TracBrowser for help on using the repository browser.