%%%%%%%%%%%%%Last Update, 7 October 2009%%%%%
% This code caluclates the BER
function output=BER(Txout,Rxout);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Raised cosine pulse%%%%%%%%%%%%%
Rxdata=Rxout(1:16:end); %Sampling
Rxdata=Rxdata(11:end); % Remove the transient effect 
Rx=sign(Rxdata); % make hard descisions on the received values (-1 or 1)
output = length(find(Rx~=Txout(1:length(Rx))))/length(Rx) %Calculate the BER
