# Matlab: How to apply constant modulus algorithm in wireless communication

I am trying to apply the Constant Modulus Algorithm which is a blind equalization algorithm in CDMA communication. I am following the code for CMA and a great explanation given in link MATLAB : Proper estimation of weights and how to calculate MSE for QPSK signal for Constant Modulus Algorithm

For different signal-to-noise ratio, I want to see the performance of CMA. But I cannot understand where to plug in the CMA part in CDMA. CMA should be at the receiver, but it is not clear to me exactly how to do so and if I need to apply the same FIR channel that is given in the CMA code. It will be very helpful is somebody can inform / show how to apply CMA. Thank you. The code for CDMA is

clc;
clear all;
code_length = input('Enter Code Length = ');
data_stream = input('Enter Data Bit Stream = ');
%Generating Walsh Code
code = [-1 -1; -1 +1];
[r1 c1] = size(code);
disp('Walsh code generated = ');
while r1<code_length
code = [code,code;code,-1*code];
[r1 c1] = size(code);
disp(code);
end
code_length = length(code); %length (number of bits) of code
Y = size(data_stream);
N = Y(1); %number of unique senders / bit streams
I = Y(2); %number of bits per stream
T = []; %sum of all transmitted and encoded data on channel
%show data bits and codes
disp('Data bit stream to be transmitted = '),disp(data_stream);
disp('Walsh codes used for transmission = '),disp(code);
%encode bits and transmit
G = zeros(I,code_length);
for n = 1:N
Z = zeros(I,code_length);
for i = 1:I
for m = 1:code_length
Z(i,m) = [data_stream(n,i)*code(n,m)];
end
end
G = G + Z;
end
%show channel traffic
for i = 1:I
T = [ T G(i,:) ];
end
disp('Resulting traffic on the channel = '),disp(T);
%decode and reconstruct
for n = 1:N
tot = zeros(1,I);
R   = zeros(I,code_length);
for i = 1:I
for m = 1:code_length
R(i,m) = G(i,m) * code (n,m);
tot(i) = tot(i) + R (i,m);
end
end
end

Output:

Enter Code Length = 4
Enter Data Bit Stream = [ 1 -1  1 -1  1  1 -1 -1 ;
-1 -1  1  1  1 -1 -1  1 ;
1  1 -1 -1 -1  1  1 -1 ;
1  1  1  1 -1 -1 -1 -1 ];

Walsh code generated =
-1    -1    -1    -1
-1     1    -1     1
-1    -1     1     1
-1     1     1    -1

Data bit stream to be transmitted =
1    -1     1    -1     1     1    -1    -1
-1    -1     1     1     1    -1    -1     1
1     1    -1    -1    -1     1     1    -1
1     1     1     1    -1    -1    -1    -1

Walsh codes used for transmission =
-1    -1    -1    -1
-1     1    -1     1
-1    -1     1     1
-1     1     1    -1


MATLAB : Proper estimation of weights and how to calculate MSE for QPSK signal for Constant Modulus Algorithm

Ok, your code is very difficult to understand, but I think that we can answer your question.

There is a group of processing blocks that every communication systems have. Normally, they appear in the following order in almost every simulation:

Bit Stream -> Modulator -> Channel -> Equalization -> Demodulator -> Received Bit Stream

Note that I suppressed some blocks like pulse shapping, matched filter, FEC, and others. This is the most simple scheme. The transmitter modulate the signal, and sends it through a channel. In the receiver, the samples needs to be equalized in order to perform the detection and demodulation properly.

So, you can conclude that the CMA blind Equalization is somewhere between the channel and the detection.

In your code I only saw the test for the Walsh Code. I am not seeing the complete system implemented (i didn't see any modulator, for example), but I assume that now you can figure out where to include the CMA equalizer.

Let me know if you need more help.

• Thank you for your reply, it is really useful at the conceptual level. I found a good tutorial in the form of a paper (e-ijaet.org/media/28I6-IJAET0612615.pdf) which I am using as a guide to simulate CDMA with CMA. I would appreciate your help in confirming if these blocks are correct or not: Rayleigh fading channel-->QPSK modulation-->spreading--->add white gaussian noise to contaminate the transmitted signal -->blind equalizer (CMA)-->dispreading--->QPSK demodulation – Ria George Oct 3 '15 at 20:09
• The correct order is: Data -> QPSK Modulation -> Spreading -> Rayleigh Fading Channel -> Add White Gaussian Noise -> Blind Equalizer -> Dispreading ->QPSK Demodulation. Glancing over the article, I saw that he initializes the Rayleigh Fading Channel before starting the simulation. No problem. Just keep in mind that although you can initialize it before, the channel effects is only applied to your signal after modulating and spreading (e.g. after sending the signal), and before adding the noise. – JohnMarvin Oct 3 '15 at 22:54