serhannn
Member level 4
- Joined
- Sep 28, 2010
- Messages
- 69
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,288
- Activity points
- 1,939
Hi, I'm trying to obtain the Channel matrix (H) and code matrix for a cdma simulation. Basically, I need the channel responses h_i's for each user i=1,...,K. But when I use the Matlab's Rayleighchan function it gives me the path gains for every symbol I transmit. What does that mean? I want to get the channel response for every user and say, if each user transmits 100 symbols and I have 10 users and channel has 3 taps, then I get a PathGains matrix of 100x3 for every one of the 10 users. But I think, for each user I should only have one channel response. Am I not correct? I am a little bit confused about this channel response thing, so forgive me if I am making any fundamental mistakes here.
My code is as follows:
So as you see I have a multidimensional array h(i) to store the channel responses and when I type for example:
I get a 100x3 matrix containing path gains for 100 symbols transmitted by the user 1 with 3 multipath fingers. At least, that's what I think what is happening. My question is: Am I not supposed to get one single channel response for each user? Or how do I obtain that channel response for this path gains matrix.
Thanks a lot.
My code is as follows:
Code:
K = 10; % Number of users
L = 3; % Number of multipath fingers for each user
M = 100; % Number of symbols transmitted by each user in each frame
G = 64; % Spreading gain = Chip rate / Symbol rate
sampleTime = 2.0e-006;
maxDopplerShift = 200; % = v*f/c [Hz]
maxDelay = 0.16;
%delayVec = 1.0e-006 * [0 0.04 0.08]; % delays of three-path channel
delayVec = 1.0e-004 * rand([K L-1]) * maxDelay; % create avg. path delays for each user (each has 3 paths)
delayVec = [zeros(K,1) delayVec]; % First path is direct path, hence 0 delay for all users
%gainVec = [0 -3 -6];
gainVec = -delayVec*10^6; % average path delays [dB], decay exponentially with delay (linearly in dB)
%%
% Modulation
hMod = comm.BPSKModulator;
bitsPerFrame = M; % Number of bits transmitted per frame = M , due to BPSK modulation
S = zeros(bitsPerFrame,K); % Create data matrix for K users, each having M symbols
modulated_S = zeros(bitsPerFrame,K); % Modulated data matrix
nFrames = 100; % Number of frames
% Create K impulse responses for each user
for i=1:K
h(i) = rayleighchan(sampleTime, maxDopplerShift, delayVec(i,:), gainVec(i,:));
h(i).StoreHistory = 1; %
h(i).ResetBeforeFiltering = 0; % preserve the continuity of fading process
for n=1:nFrames
S(:,i) = randi([0 1],bitsPerFrame,1); % Create the message bits for i-th user
modulated_S(:,i) = step(hMod, S(:,i)); % Modulate the message of i-th user into BPSK symbols
Y(:,i) = filter(h(i),modulated_S(:,i)); % Apply the channel of i-th user to the modulated message
end
end
So as you see I have a multidimensional array h(i) to store the channel responses and when I type for example:
Code:
h(1).PathGains
I get a 100x3 matrix containing path gains for 100 symbols transmitted by the user 1 with 3 multipath fingers. At least, that's what I think what is happening. My question is: Am I not supposed to get one single channel response for each user? Or how do I obtain that channel response for this path gains matrix.
Thanks a lot.