can anyone help me model my channel to follow a Rayleigh channel so that my BER curve will be a linear one not exponential

3 vues (au cours des 30 derniers jours)
%Transmitting End of MISO system
clear
%close all
clc
%% System Parameters
M = 8 ;% modulation order
N = 5e4;%number of message samples
nTx = 2; % number of transmitting antennas
nRx = 1;
noise_power_db = -30;
SNR_dB = -20:5:15; %result oriented
SNR_ln = 10.^(SNR_dB./10);%code oriented
phase_shift = 0;
bit_errors = zeros(1,length(SNR_dB));
%% Transmitter
message = randi([0 M-1],nTx,N);
bits = de2bi(message,log2(M)); %Converting the message to bits
x = pskmod(message,M,phase_shift); % modulating the message (PSK)
%x = qammod(message,M);
x_hat = zeros(nTx,N);
constellation = pskmod(0:M-1,M,phase_shift);
%constellation = qammod(0:M-1,M);
scatterplot(constellation);
combinations = nchoosek(repmat(constellation,1,nTx),nTx);
combined_symbols = unique(combinations,'rows').';
%% building the Channnel // The channel(random variable) follows a Raleigh distribution
for kk = 1:length(SNR_dB)
for ii = 1:N
H = (randn(nRx,nTx)+1i*randn(nRx,nTx))/sqrt(2);
% Receiving End of MISO System
% Noise will surely be experienced at te receiving end
Es = mean2(abs(combined_symbols).^2);
sigma = (Es*nRx)./(log2(M)*SNR_ln(kk));
n = sqrt (sigma/2).*(randn(nRx,1)+ 1i*randn(nRx,1));
% Received Output
y = H*x(:,ii) + n;
%% Receiver
distances = [];
for tt = 1:length(combined_symbols)
ref = H*combined_symbols(:,tt);
distances(:,tt) = norm(y - ref); % Compute Euclidean distance
end
[x_value,x_index] = sort(distances);
detected_symbols = combined_symbols(:,x_index(1));
x_hat(:,ii) = detected_symbols;
end
% Calculate bit error rate (BER)
predicted_message = pskdemod(x_hat,M,phase_shift);
%predicted_message = qamdemod(x_hat,M);
predicted_bits = de2bi(predicted_message,log2(M));
bit_errors(kk) = mean2(predicted_bits ~= bits);
end
%Plot BER curves
figure(2);
hold on;
plot(SNR_dB, bit_errors,'-bh',LineWidth=1.5);
set(gca, 'YScale', 'log');
xlabel('SNR(dB)');
ylabel('Bit Error Rate (BER)');
title('BER Curve for MISO System');
grid on;

Réponses (1)

Aastha
Aastha le 3 Sep 2024
Hi Abranyor Salman,
I understand that you want to model your channel distributed according to a Rayleigh distribution using a MISO (multiple input single output) system model. Further, you want the BER versus SNR curve to be linear in nature.
I have made some modifications to the code which are as follows:
•At the receiver of a MISO system with Rayleigh fading channel, the received symbol will be a sum of all transmitted symbols weighted by the Rayleigh channel coefficients along with an AWGN noise. The rank of the channel matrix is one which implies that only one independent data stream can be transmitted.
Therefore, all the transmitting antennas will transmit the same data-symbol.
•When decoding the transmitted data-symbol, you can first multiply the received signal by the conjugate of the channel matrix and then divide by its norm. The resultant signal can then be decoded using minimum distance decoding, and the Bit Error Rate (BER) can be computed.
Here is the modified code for your reference:
%Transmitting End of MISO system
clear
%close all
clc
%% System Parameters
M = 8 ;% modulation order
N = 5e4;%number of message samples
nTx = 2; % number of transmitting antennas
nRx = 1;
noise_power_db = -30;
SNR_dB = -20:5:15; %result oriented
SNR_ln = 10.^(SNR_dB./10);%code oriented
phase_shift = 0;
bit_errors = zeros(1,length(SNR_dB));
%% Transmitter
message = repmat(randi([0 M-1],1,N),nTx,1);
bits = de2bi(message,log2(M)); %Converting the message to bits
x = pskmod(message,M,phase_shift); % modulating the message (PSK)
%x = qammod(message,M);
x_hat = zeros(nTx,N);
constellation = pskmod(0:M-1,M,phase_shift);
%constellation = qammod(0:M-1,M);
scatterplot(constellation);
combinations = nchoosek(repmat(constellation,1,nTx),nTx);
combined_symbols = unique(combinations,'rows').';
%% building the Channnel // The channel(random variable) follows a Raleigh distribution
for kk = 1:length(SNR_dB)
for ii = 1:N
H = (randn(nRx,nTx)+1i*randn(nRx,nTx))/sqrt(2);
% Receiving End of MISO System
% Noise will surely be experienced at te receiving end
Es = mean2(abs(combined_symbols).^2);
sigma = (Es*nRx)./(log2(M)*SNR_ln(kk));
n = sqrt (sigma/2).*(randn(nRx,1)+ 1i*randn(nRx,1));
% Received Output
y = H*x(:,ii) + n;
%% Receiver
distances = [];
for tt = 1:length(combined_symbols)
ref = H*combined_symbols(:,tt);
ref = ref./norm(H,2);
distances(:,tt) = norm(y - ref); % Compute Euclidean distance
end
[x_value,x_index] = sort(distances);
detected_symbols = combined_symbols(:,x_index(1));
x_hat(:,ii) = detected_symbols;
end
%Calculate bit error rate (BER)
predicted_message = pskdemod(x_hat,M,phase_shift);
%predicted_message = qamdemod(x_hat,M);
predicted_bits = de2bi(predicted_message,log2(M));
bit_errors(kk) = mean2(predicted_bits ~= bits);
end
%Plot BER curves
figure(2);
hold on;
plot(SNR_dB, bit_errors,'-bh',LineWidth=1.5);
set(gca, 'YScale', 'log');
xlabel('SNR(dB)');
ylabel('Bit Error Rate (BER)');
title('BER Curve for MISO System');
grid on;
On running the above mentioned code, a linear curve for BER versus SNR is obtained.
I hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by