function ier = blockcodecomputeier(n,k,t,ebno);

r=k/n;                              % code rate

pe=Q(sqrt(r*2*ebno));       % error probability of each bit in codeword
PB=1;                       % block error
for i=0:t,                      % loop to compute block error rate
    PB=PB-nchoosek(n,i)*pe^i*(1-pe)^(n-i);
end
ier=PB/k;            % approximation to compute information error rate
