Search code examples
matlabsignal-processingequalizer

Matlab : What is the BER performance of Constant Modulus Algorithm and issue in filter function


I need help in plotting the Bit error curve or the symbol error curve for BPSK modulation scheme for varying Signal to Noise ratios or Eb/N0. The plot should show the simulated versus the theoretical curve, but I cannot figure out how to mitigate the problems when using the Constant Modulus Algorithm as an Equalizer which are:

(1)

 Error using  * 
Inner matrix dimensions must agree.

Error in BER_BPSK_CMA (line 50)
        yy = w'*x;

(2) I want to use the filter function instead of conv in order to model a moving average channel model, chanOut = filter(ht,1,s). But, when I use filter, I am getting an error. How can I use filter function here?

(3) Bit error rate calculation

UPDATED Code with the Problem 1 solved. However, I am still unable to use filter and unsure if BER curve is proper or not. Below is the code I wrote:

% Script for computing the BER for BPSK modulation in 3 tap ISI 
% channel 


clear
N  = 10^2; % number of bits or symbols
Eb_N0_dB = [0:15]; % multiple Eb/N0 values
K = 3; %number of users
nTap = 3;
mu = 0.001;
   ht = [0.2 0.9 0.3]; 
   L  = length(ht);
for ii = 1:length(Eb_N0_dB)

   % Transmitter
   ip = rand(1,N)>0.5; % generating 0,1 with equal probability
   s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0 

   % Channel model, multipath channel

chanOut = conv(s,ht);
%   chanOut =  filter(ht,1,s);  %MA 
   n = 1/sqrt(2)*[randn(1,N+length(ht)-1) + j*randn(1,N+length(ht)-1)]; % white gaussian noise, 0dB variance 

   % Noise addition
   y = chanOut + 10^(-Eb_N0_dB(ii)/20)*n; % additive white gaussian noise


   %CMA
  Le =20; %Equalizer length

   e = zeros(N,1);     % error
w = zeros(Le,1);    % equalizer coefficients
w(Le)=1;            % actual filter taps are flipud(w)!  
yd = zeros(N,1);
r = y';
% while(1)
    for i = 1:N-Le,
        x = r(i:Le+i-1);
        %x = r(i:(Le+i-1));
        yy = w'*x;
        yd(i)= yy;
        e(i) = yy^2 - 1;
        mse_signal(ii,i) = mean(e.*e);
        w = w - mu * e(i) * yy * x;

    end

   sb=w'*x;   % estimate symbols (perform equalization)

   % receiver - hard decision decoding
   ipHat = real(sb)>0;

   % counting the errors
   nErr_CMA(ii) = size(find([ip- ipHat]),2);
   % calculate SER




end
simBer_CMA = nErr_CMA/N;

theoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber

for i=1:length(Eb_N0_dB),
   tmp=10.^(i/10);
   tmp=sqrt(tmp);
  theoryBer(i)=0.5*erfc(tmp);
end

figure
semilogy(theoryBer,'b'),grid;
hold on;



semilogy(Eb_N0_dB,simBer_CMA,'r-','Linewidth',2);

%axis([0 14 10^-5 0.5])
grid on
legend('sim-CMA');
xlabel('Eb/No, dB');
ylabel('Bit Error Rate');
title('Bit error probability curve for BPSK in ISI with CMA equalizer');

BER


Solution

  • There's an error in these three lines:

    sb=w'*x;   % estimate symbols (perform equalization)
    
    % receiver - hard decision decoding
    ipHat = real(sb)>0;
    

    they worked inside the while loop but you are now performing a post-estimation, so the correct lines are:

    sb=conv(w,y);   % estimate symbols (perform equalization)
    
    % receiver - hard decision decoding
    ipHat = real(sb(Le+1:end-1))>0;   % account for the filter delay
    

    There is still some issue with the output... but I can't go further in the analisys.