Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

single Relay simulation using QAM

Status
Not open for further replies.

amana

Newbie level 1
Joined
Jul 3, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
5
Hi all
I have code for single link (source- destination) using QAM simulation to produce BER curve. however I need to add relay node between source and destination and produce BER curve. can anyone help me with this please
here is the code (matlab)
Code:
M = 16;                     % Size of signal constellation
k = log2(M);                % Number of bits per symbol
n = 10^6;                    % Number of bits to process
nSyms = n/k;                % Number of symbols

hMod = modem.qammod(M);         % Create a 16-QAM modulator
hMod.InputType = 'Bit';         % Accept bits as inputs
hMod.SymbolOrder = 'Gray';         % Accept bits as inputs
hDemod = modem.qamdemod(hMod);  % Create a 16-QAM based on the modulator

x = randi([0 1],n,1); % Random binary data stream
tx = modulate(hMod,x);

EbNo = 0:10; % In dB
SNR = EbNo + 10*log10(k);

rx = zeros(nSyms,length(SNR));
% Simulation bit error rate
bit_error_rate = zeros(length(SNR),1);
for i=1:length(SNR)
    rx(:,i) = awgn(tx,SNR(i),'measured');
end

% Demodulation
rx_demod = demodulate(hDemod,rx);
for i=1:length(SNR)
    [num,bit_error_rate(i)] = biterr(x,rx_demod(:,i));
end

% fprintf('\nThe Gray coding bit error rate = %5.2e,  based on %d errors\n', ...
%     bit_error_rate(i), num)

% Theoritical bit error rate

theoryBer = (1/k)*3/2*erfc(sqrt(k*0.1*(10.^(EbNo/10))));
figure;
semilogy(EbNo,theoryBer,'ro-',EbNo, bit_error_rate, 'b*');
grid on;
legend('theory', 'simulation ');
xlabel('Eb/No, dB');
ylabel('Bit Error Rate');
title('Bit error probability curve for 16-QAM modulation');
Thanks in advance
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top