function [snrlow, snrhigh] = capsnr(rate) %CAPSNR - % [SNRLOW, SNRHIGH] = CAPSNR(CAP) calculates upper (SNRHIGH) and lower % (SNRLOW) bounds on the SNR required (in dB) to achieve the capacity % given by CAP for the binary input AWGN channel. % % For example, to calculate the minimum SNR required to achieve capacity % for a binary rate R code (R<1), use [SNRLOW, SNRHIGH] = CAPSNR(R) % % (C) Mark Shane (shane@ee.ucla.edu) and Richard Wesel (wesel@ee.ucla.edu) % University of California, Los Angeles snrlow = fzero('bincapup',0,optimset('disp','off'),rate); snrhigh = fzero('bincaplo',0,optimset('disp','off'),rate); function y = Q(x) y = 0.5*erfc(x/sqrt(2));