# Help me out in finding the problem in my given MATLAB code of Rectangular Contour Algorithm(RCA)

I am implementing the Rectangular Contour Algorithm (RCA) used for blind channel equalization on 32 Rectangular QAM Signal, polluted with noise and channel effects. It is described in:

Khan Q. - Two Novel Blind Equalization Algorithms for Rectangular Quadrature Amplitude Modulation Constellations

I am not achieving reduction in the ISI value in dB as the iterations increases. When I use exact value of $\mu$ as given in research paper it diverges giving equalizer tap weights to NaN and everything goes to NaN. But decreasing the step size $\mu$ it becomes stable, whilst ISI increases instead of decreases.

Here is my MATLAB Code:

clc;
clear all;
close all
m = 32;
SNR = 30;
ITERATIONS=5000;
RUNS= 3;
%h=[-0.005-j*0.004 0.009+j*0.030 -0.024-j*0.104 0.854+j*0.520 -0.218+j*0.273 0.049-j*0.074 -0.016+j*0.020];

h=randn(1,7)+i*randn(1,7);
%h=h/norm(h);

N =length(h);                                      %equalizer length
M =32;
x = 0:M-1;
y = modulate(modem.qammod(M),x);
%32 rect qam
A1 = [-7 7 -7 7 real(y(5:28)) 7 -7 7 -7]';
B1 = [-3 -3 3 3 imag(y(5:28)) -1 -1 1 1]';
Y1=A1+j*B1;
%scatterplot(Y1)
QAM = Y1';
Es = mean(abs(QAM).^2);                     % Average Signal energy
S=floor((N-1)/2);

nm = N-1;
Res_ISI = zeros(1,ITERATIONS);
MSEn = zeros(1,ITERATIONS);
bn=zeros(1,ITERATIONS);
%h = h./sqrt(sum(abs(h).^2));
R = length(h)-1;
cl = length(h)-1;
varn = Es*10^(-SNR/10);
stdn=sqrt(varn);
stdn_by_2 = stdn/sqrt(2);

for runs=1:RUNS
R_S=[];
E_O=[];
W=zeros(N,1);
W(S,1)=1;
C = zeros(N,1);
X = zeros(cl+1,1);
disp(['Run = ' num2str(runs)]);
for i = 1:ITERATIONS
x = QAM(ceil(rand*m));
X = [x; X(1:cl,1)];
Ns = (randn+j*randn)*stdn_by_2;
c = h*X + Ns;
C = [c ; C(1:nm,1)];
YY = transpose(W)*C;%Equalizer Output
E_O=[YY E_O];
R_S=[c R_S];

%RECT Contour Implementation
mu = 1e-15;
A=7;
B=3;
R_rect=1.7927;%32 RQAM
P=1;
YR=real(YY);
YI=imag(YY);
T1=B*YR+A*YI;
T2=B*YR-A*YI;
S1=sign(T1);
S2=sign(T2);
S3=A*YR-A*YI;

%Del Jrect Equation
del_Jrect=((abs(T1)+abs(T2)).^P-(abs(A*B)*R_rect).^P).*((abs(T1)+abs(T2)).^(P-1)).*((B*S1+B*S3)+i*(A*S1-A*S2));
del_Jrect=del_Jrect.*conj(C);
%Taps Update Equation
W=W-(mu*del_Jrect);

TA=abs((h.*conj(W)')).^2;
TB=max(TA);
res_isi(1,i)=(sum(TA)-TB)/TB;
end
Res_ISI = Res_ISI+res_isi;
%    MSEn = MSEn+mse;
scatterplot(R_S);
%scatterplot(filter(W,1,R_S));
end
% end

Res_ISI=Res_ISI/runs;

%____________________________________________________________
figure;
plot(10*log10(abs(smooth(Res_ISI,100))));grid on;
ylabel('ISI(dB)'); xlabel('Iterations');

• Please include your code inline (not as pictures) with the proper formatting. Also, include a reference or two to the algorithm's description. – MBaz Mar 20 '17 at 14:42
• I'm closing this question because there is no effort to paste the code. – jojek Mar 20 '17 at 20:55
• Dear jojek the code was too lengthy to put in the body section as I have already tried to put it in the body section but it was not copied properly from the software. – Faizan Zaheer Mar 21 '17 at 16:56
• Please also guide me how to put code as inline? – Faizan Zaheer Mar 21 '17 at 16:57
• I have put the code as inline.pls open my question to public. – Faizan Zaheer Mar 21 '17 at 17:03