
clear
f=5.11;%Factorul de zgomot in exces
 m=200.15;%Curentul mediu al fotodiodei
 a=m*f/(f-1);b=m-a;
 sigma=102.66/1.41;
 lamda=m*f/((f-1)*sigma);
 d=lamda^2;
x=90:.5:310;
%si=[.5 5 16];
si=[.0005 10 19];
nl=length(x);aa=zeros(2,nl);
for m=1:3
for k=1:nl,
v=si(m)^2;
w=v^2;
g=a/d;
h(k)=x(k)-b;
c(1)=2*g*w;
c(2)=-v*(v+4*h(k)*g);
c(3)=2*h(k)*(v+g*h(k));
c(4)=a^2-h(k)^2;
roots(c);
z=roots(c);
t=z(3);
n=49000;
r=h(k)-v*t;
q=a/r;
e=(-1)*h(k)*t+(1/2)*v*t^2+d*(1-q);
p=v+(r^3)/(a*d);
s(k)=(n/(2*pi*p))^1/2*exp(n*e);
end
i=min(x)
j=max(x)
l=min(s)
o=max(s)
z=trapz(x,s)
nor=1/z
s1=nor*s;aa(m:m,1:nl)=s1;
%axis([i j l o])  	
%col(m,1)=plot(x,s1),
o1=nor*o
%text(400,o1,'si=')

semilogy(x,s1)
%axis([170 230 10^(-40) 10^0])
axis([197 203 10^(-20) 10^0])

hold on
end
dd=aa(1:1,1:nl)-aa(2:2,1:nl);
ee=dd.^2;
ff=aa(1:1,1:nl)-aa(3:3,1:nl);
gg=ff.^2;