|
hello,
I'm trying to characterize different pulse shapes and how they impact equalization requirements for single carrier. I have all my code finished except for the equalizer. I'm having a hard time designing it in matlab. My code is shown below. The equalizer
I'm using below is implementing the LMS (least mean square) algorithm. This code gives me an SER of 0.5. Can you see what is wrong with my equalizer?
%function SER_rrcosine_Rayleigh
N=10^5; % # of symbols
os = 2; % oversample factor
delay = 4;
Es_No_dB = (2:30);
ipHat = zeros(1,N);
% Root raised cosine filter
g_sqrc = rcosine(1,os,'fir/sqrt',0.5,delay);
pulse_shape = g_sqrc;
for ii = 1: length(Es_No_dB)
%Transmitted signal
ip = (2*(rand(1,N)>0.5)-1) + j*(2*(rand(1,N)>0.5)-1); % QPSK modulation
s = (1/sqrt(2))*ip; % normalization of energy to 1, length of s is N = 1e6
% filtered sequences
sFilt = rcosflt(s,1,os,'filter',pulse_shape);
h = sqrt(0.5)*[randn(1,N*os)+ j*randn(1,N*os)]; % Rayleigh channel
% Add flat fading Rayleigh channel
y1 = filter(h,1,sFilt);
y_1 = awgn(y1,ii,'measured');
% matched filter
yFilt = rcosflt(y_1,1,os,'Fs/filter',pulse_shape);
ySamp = downsample(yFilt,os);
ySamp = ySamp(2*delay+1:end-2*delay);
% equalization
for kk = 30:N
Y(:,kk) = ySamp(kk:-1:kk-29);
end
% LMS Algorithm used to equalize the channel
h_est = zeros(30,1);
mu = 0.001;
for jj = 7:N
e(jj) = s(jj-6)-h_est'*Y(:,jj);
h_est = h_est + mu*conj(e(jj))*Y(:,jj);
end
s_est = h_est'*Y;
% demodulation
y_re = real(s_est); % real
y_im = imag(s_est); % imaginary
ipHat(find(y_re < 0 & y_im < 0)) = -1 + -1*j;
ipHat(find(y_re >= 0 & y_im > 0)) = 1 + 1*j;
ipHat(find(y_re < 0 & y_im >= 0)) = -1 + 1*j;
ipHat(find(y_re >= 0 & y_im < 0)) = 1 - 1*j;
% counting the errors
nErr(ii) = size(find([ip- ipHat]),2);
end
simSer = nErr/N;
EsNoLin = 10.^(Es_No_dB/10);
theorySer_Rayleigh = 0.5.*(1-sqrt(EsNoLin./(EsNoLin+1)));
close all
figure
semilogy(Es_No_dB,simSer,'m','LineWidth',2);
hold on
semilogy(Es_No_dB,theorySer_Rayleigh,'bp-','LineWidth',2);
axis([2 10 10^-6 1])
grid on
[c, lags] = xcov (ip,ipHat,100,'coeff');
figure(2)
stem(lags,c)
|