Rob87
Newbie level 1
recov_data matlab
Hello everyone,
I've been trying to simulate a Rayleigh channel in Matlab and have stumbled upon a difficulty. Originaly i was given a simulation that calculates the BER of an AWGN channel in QPSK, and was asked to change it to a Rayleigh fading channel.
The Original program is as such:
-------------------------------------------------------------------------------------
clear;
N_loop = 10^4;
N_sym =100 ;
N_bit=2*N_sym;
awgn_sigma = sqrt(0.5);
Eb_dB=5:1:9;
Eb = 10.^(Eb_dB/10);
sqrt_Es = sqrt(2*Eb);
BER = zeros(1,length(Eb));
normalized = 1/sqrt(2);
BER1 = zeros(1,length(Eb));
for n=1:N_loop;
D = floor(2*rand(1,N_sym))+j*floor(2*rand(1,N_sym));
Tx_data = normalized * (2*D-(1+j));
Noise=awgn_sigma*(randn(N_sym,length(Eb_dB))+j*randn(N_sym,length(Eb_dB)));
Rx_data =transpose(Tx_data)*sqrt_Es+ Noise;
Recov_data = 0.5*(1+j+sign(real(Rx_data))+j * sign(imag(Rx_data)));
BER = BER+sum((abs(Recov_data-transpose(D)*ones(1,length(Eb_dB)))).^2)/N_bit;
end;
BER = BER/N_loop
semilogy(Eb_dB,BER,'*-');
xlabel('Eb/N0 (dB)');
ylabel('BER');
-------------------------------------------------------------------------------------
The problem i'm facing is, even though i know the channel can be described as two Gaussian sources like:
H= awgn_sigma*(randn(N_sym,length(Eb_dB))+j*randn(N_sym,length(Eb_dB)));
i get an error in matlab telling me that the inner matrix dimensions must agree. i changed the function of H to be a 1x1 matrix, but when i add it to my signal
Rx_data =H*transpose(Tx_data)*sqrt_Es+ Noise;
i get a BER of 0.5 which i know is wrong.
If anyone can please help me. I'm sure i got the theory down right, but i can't seem to apply it to my simulation.
Thanks in advance,
Robert
Hello everyone,
I've been trying to simulate a Rayleigh channel in Matlab and have stumbled upon a difficulty. Originaly i was given a simulation that calculates the BER of an AWGN channel in QPSK, and was asked to change it to a Rayleigh fading channel.
The Original program is as such:
-------------------------------------------------------------------------------------
clear;
N_loop = 10^4;
N_sym =100 ;
N_bit=2*N_sym;
awgn_sigma = sqrt(0.5);
Eb_dB=5:1:9;
Eb = 10.^(Eb_dB/10);
sqrt_Es = sqrt(2*Eb);
BER = zeros(1,length(Eb));
normalized = 1/sqrt(2);
BER1 = zeros(1,length(Eb));
for n=1:N_loop;
D = floor(2*rand(1,N_sym))+j*floor(2*rand(1,N_sym));
Tx_data = normalized * (2*D-(1+j));
Noise=awgn_sigma*(randn(N_sym,length(Eb_dB))+j*randn(N_sym,length(Eb_dB)));
Rx_data =transpose(Tx_data)*sqrt_Es+ Noise;
Recov_data = 0.5*(1+j+sign(real(Rx_data))+j * sign(imag(Rx_data)));
BER = BER+sum((abs(Recov_data-transpose(D)*ones(1,length(Eb_dB)))).^2)/N_bit;
end;
BER = BER/N_loop
semilogy(Eb_dB,BER,'*-');
xlabel('Eb/N0 (dB)');
ylabel('BER');
-------------------------------------------------------------------------------------
The problem i'm facing is, even though i know the channel can be described as two Gaussian sources like:
H= awgn_sigma*(randn(N_sym,length(Eb_dB))+j*randn(N_sym,length(Eb_dB)));
i get an error in matlab telling me that the inner matrix dimensions must agree. i changed the function of H to be a 1x1 matrix, but when i add it to my signal
Rx_data =H*transpose(Tx_data)*sqrt_Es+ Noise;
i get a BER of 0.5 which i know is wrong.
If anyone can please help me. I'm sure i got the theory down right, but i can't seem to apply it to my simulation.
Thanks in advance,
Robert