Hello,
I am relatively new to Matlab and I find it quite hard to really get started on my problem and I hope to find some help here.
I checked the already existing threads, but it didn't really help me and since the threads are quite old I hope it's ok to start a new one.
OK to my task:
I need to simulate the bi-directional wireless communication between four users (so six channels in total, since there are supposed to be identical in both directions). The only hint I got for this task is Rayleigh Fading channel and that there will be interference between the different signals.
I searched in the Matlab documentation and read everything about rayleighchan and fading channels. There I found an example of which I think it could be of use to me, I changed it very slightly
Code:
bitRate = 50000;
hMod = comm.BPSKModulator; % Create a BPSK modulator
hDemod = comm.BPSKDemodulator; % Create a BPSK demodulator
% Create Rayleigh fading channel object.
ch = rayleighchan(1/bitRate,4,[0 0.5/bitRate],[0 -10]);
delay = ch.ChannelFilterDelay;
tx = randi([0 1],50000,1); % Generate random bit stream
bpskSig = step(hMod,tx); % BPSK modulate signal
fadedSig = filter(ch,bpskSig); % Apply channel effects
rx = step(hDemod,fadedSig); % Demodulate signal
The code creates a bit sequence, modulates it using BPSK, creates a rayleigh channel, applies the effects and then demodulates it.
What else do I need to do?
Also here I have just one channel, since I need six that interfere with each other. creating six different rayleigh channels can't be the solution, so I tried
Code:
tx = randi([0 1],50000,5)
But Matlab tells me that the input for step must be a clumn vector, so I can't use a matrix there. So I changed the code to
Code:
bitRate = 50000;
hMod = comm.BPSKModulator; % Create a BPSK modulator
hDemod = comm.BPSKDemodulator; % Create a BPSK demodulator
% Create Rayleigh fading channel object.
ch = rayleighchan(1/bitRate,4,[0 0.5/bitRate],[0 -10]);
delay = ch.ChannelFilterDelay;
Tx = nan(5000,6);
Rx = nan(5000,6);
for i=1:1:6
tx = randi([0 1],50000,1); % Generate random bit stream
bpskSig = step(hMod,tx); % BPSK modulate signal
fadedSig = filter(ch,bpskSig); % Apply channel effects
rx = step(hDemod,fadedSig); % Demodulate signa
for j=1:1:50000
Tx(j,i) = tx(i);
Rx(j,i) = rx(i);
end
end
Is this the correct approach to simulate the channel or am I completely wrong here?
Any help or suggestions are appreciated.
I hope I didn't make it too confusing, but if something is unclear please let me know