DSPRelated.com
Forums

Matlab 'rayleighchan' and RAKE receiver.

Started by prasannas September 17, 2008
Hi, I was trying to reuse my old RAKE receiver matlab code which also
includes delay acquisition and channel estimation. It still works fine for
AWGN, but it doesn't work at all when I try to use it with a fading channel
generated by using the 'rayleighchan' function from Matlab.

So I tried a few tests: 
1) Instead of using the estimated channel coefficients, I let the RAKE
receiver have perfect CSI. 
2) I used integer number of delays for multi-paths, so that my RAKE
receiver has accurate information of the delays as well. No delay
acquisition.

Even then I could not get the RAKE receiver to work. I should mention that
the doppler frequency I used was close to 10 Hz, which is too small to be a
problem. 

When I created the multipath channel myself (using the tapped delay line
model), I could get my RAKE receiver to work perfectly (see matlab code
below). 

So what the heck is 'rayleighchan' doing that is different from building a
TDL model? 

I am also including some matlab test code that might help anyone who is
interested in this problem to better understand it. Thanks in advance for
any inputs!

BR, Prasanna

%=============
%Matlab code:
%=============
clear all

SF = 128;
% Generate OVSF codes
ovsf_codes = hadamard(SF);
% Generate Gold code sequence
%   Sequence in the file is generated using the m-script |gold_seq_gen.m|
load ScramblingCodes.mat scr;
% Constellation for QPSK mapping
qpskcon = [1+i, -1+i, 1-i, -1-i];

dpch_mod = qpskcon(randint(1, 2560/SF, 4)+1);
dpch_spread =
kron(dpch_mod,ones(1,SF)).*kron(ones(1,2560/SF),ovsf_codes(2,:));
pich_spread = (1+i)*ones(1,2560); % using all one ovsf code

tx_signal = (dpch_spread + pich_spread) .* scr(1:2560);

ChannelCoeff = 0.5*[1+i, 1-i];
delay = [0,8];

%% Uncomment the following four lines to use 'rayleighchan'
% doppler_freq = 10; % Hz
% fading_channel = rayleighchan(1/3.84e6, doppler_freq, delay/3.84e6);
% faded_signal = filter(fading_channel, tx_signal);
% ChannelCoeff = fading_channel.PathGains;

%% Comment the following line to use 'rayleighchan'
faded_signal = ChannelCoeff(1)*tx_signal + ChannelCoeff(2)*[zeros(1,8),
tx_signal(1:end-8)];

rx_signal = faded_signal;

% RAKE
finger1 = rx_signal .* conj(scr(1:2560));
dpch_despread1 = sum ( reshape(finger1, 128, 2560/128) .*
repmat(ovsf_codes(2,:).',1,2560/128), 1) / 128;
pich_despread1 = sum ( reshape(finger1, 128, 2560/128) , 1) / 128;
finger2 = [zeros(1,8), rx_signal(1:end-8)] .* conj(scr(1:2560));
dpch_despread2 = sum ( reshape(finger2, 128, 2560/128) .*
repmat(ovsf_codes(2,:).',1,2560/128), 1) / 128;
pich_despread2 = sum ( reshape(finger2, 128, 2560/128) , 1) / 128;

dpch_demod = dpch_despread1 * conj(ChannelCoeff(1)) + dpch_despread2 *
conj(ChannelCoeff(2));

%% Compare dpch_mod and dpch_demod in whatever way you choose. I do it by
a constellation plot.


>% RAKE >finger1 = rx_signal .* conj(scr(1:2560)); >dpch_despread1 = sum ( reshape(finger1, 128, 2560/128) .* >repmat(ovsf_codes(2,:).',1,2560/128), 1) / 128; >pich_despread1 = sum ( reshape(finger1, 128, 2560/128) , 1) / 128; >finger2 = [zeros(1,8), rx_signal(1:end-8)] .* conj(scr(1:2560));
I should have had this as finger2 = [rx_signal(9:end) zeros(1,8)] .* conj(scr(1:2560)); Then it works fine. I now have to go figure out why my old RAKE doesn't work... may be it has a similar problem. BR, Prasanna