p=0.187966*10^(-2);%modelul gilbert-elliot
q=0.080617;
pg=0.563331*10^(-3);
pb=0.417201;
zg=q/(p+q);
zb=p/(p+q);
age=1:7000;
pge=zg*pg+zb*pb;
xx=sqrt(((1-p)*(1-pg)+(1-q)*(1-pb))^2-4*(1-p)*(1-q)*(1-pb)*(1-pg)+4*p*q*(1-pb)*(1-pg));
lamb1=((1-p)*(1-pg)+(1-q)*(1-pb)+xx)/2;
lamb2=((1-p)*(1-pg)+(1-q)*(1-pb)-xx)/2;
y1=(q*(1-pg))/(lamb1-(1-q)*(1-pb));
y2=(q*(1-pg))/(lamb2-(1-q)*(1-pb));
w1=(1/pge)*(zg*pg+y1*zb*pb)*((y2-1)/(y2-y1));
w2=1-w1;
fge=w1*lamb1.^(age-1)+w2*lamb2.^(age-1);
loglog(age,fge)


