p=[1 .9];ntot=8;
f=0:1/ntot:.5;
t=(norm(p))^2;
ex_bar=1;
snrmfb=10;
noise_var=ex_bar*t/(10^(snrmfb/10));

en=zeros(1,ntot/2+1);
bn=zeros(1,ntot/2+1);
gn=zeros(1,ntot/2+1);
hn=zeros(1,ntot/2+1);
for k=1:ntot/2+1
   
   for l=1:length(p)
      hn(k)=hn(k)+p(l)*exp(j*2*pi*f(k)*(l-1));
      
      
      
end
gn(k)=abs(hn(k))^2/noise_var;
end
b=[1 2 3 4 5];d=zeros(5,5);
for s=1:5
d(s,1)=10^.88*(2^(2*s)-1)/gn(1);
d(s,5)=10^.88*(2^(2*s)-1)/gn(5);

end
for k=2:4
   for s=1:5
      d(s,k)=2*10^.88*(2^(s)-1)/gn(k);
   end
   end
 for k=1:5  
 dd(1,k)=d(1,k);  
end
for k=1:5
for s=2:5
dd(s,k)=d(s,k)-d(s-1,k);
end
end
