Borrar filtros
Borrar filtros

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

31 visualizaciones (últimos 30 días)
%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;

Respuestas (0)

Categorías

Más información sobre Propagation and Channel Models en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by