%functia de corelatie a erorilor
p11=0.998511; %modelul fritchman cu trei stari
p31=0.142542;
p13=0.001489;
p32=0.396651;
p23=0.135132;
p22=0.864868;
N=100;
vec=1:N;
a=1:N+1;
b=2:N+1;
ffr1=(p31/p11)*p11.^(b-1)+(p32/p22)*p22.^(b-1);
ffr=[1 ffr1];
ffr2=ffr(1,1:N);
f=ffr2-ffr1;

R1=zeros(1,N-2);
R2=f(1)^2+f(2);
h=[f(1) R2 R1];

for j=3:N
	s=0;
	for i=1:j-1
		s=s+f(i)*h(j-i);
	end
	h(j)=f(j)+s;
end 

semilogx(vec,h)