Η παρουσίαση φορτώνεται. Παρακαλείστε να περιμένετε

Η παρουσίαση φορτώνεται. Παρακαλείστε να περιμένετε

Simulation of Communication Links

Παρόμοιες παρουσιάσεις


Παρουσίαση με θέμα: "Simulation of Communication Links"— Μεταγράφημα παρουσίασης:

1 Simulation of Communication Links

2 Signal-to-noise ratio (SNR)
Στη προσομοίωση καθορίζουμε το SNR στην είσοδο του δέκτη, το οποίο ισοδυναμεί με το Es/N0 και από το οποίο προκύπτει το Eb/N0.

3 Additive White Gaussian Noise
x (Amplitude) μ σ + 3 - μ - σ μ+ 607 . a f x n ( ) = 1 2 πσ G ~ (μ, σ ) Variance 2 = Power

4 AWGN in time domain Στο πεδίο του χρόνου το σήμα rv = randn(1, N) μπορεί εύκολα να γίνει plot. Παρακάτω δίνονται 100 δείγματα του σήματος του Gaussian θορύβου: plot(rv(1:100))

5 PDF of white Gaussian noise

6 Generation of Gaussian random variable
clear; N=50000; bins=200; rv = randn(1,N); % white Gaussian noise [n xout]=hist (rv,bins); val_max = max(abs(xout)); %find max in order to determine bin width bar(xout, n/(N*2*val_max/bins) ) % ! ! ! ! ! axis ([ ] ) xlabel('amplitude') ylabel('probability density function') h = findobj (gca, 'Type' , 'patch' ) ; set (h, 'FaceColor', 'r' , 'LineStyle', ':' , 'EdgeColor', 'w' ) hold on y = pdf('Normal',-3:0.1:3, 0, 1) ; x=-3:0.1:3; plot (x, y, '*' )

7 Noise power for specific SNR
% white Gaussian noise, 1 or 0dB variance n = (1/sqrt(2))*[randn(1,N) + j*randn(1,N)]; Για Εs = 1 και SNR in dB given by Es_N0_dB Τα δείγματα του θορύβου θα δίνονται από τη σχέση Δηλαδή κάνουμε scaling noise samples of power =1 to power n1 = 10^(-Es_N0_dB(ii)/20)*n;

8 Simulation of BPSK in AWGN (1/3)
clear N = 10^6; % number of bits or symbols  ip = rand(1,N)>0.5; % generating 0,1 with equal probability s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 1   Es_N0_dB = [0:1:10]; % multiple Eb/N0 values  for ii = 1:length(Es_N0_dB) % white Gaussian noise, 0dB variance n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; y = s + 10^(-Es_N0_dB(ii)/20)*n; % receiver - hard decision decoding ipHat = real(y)>0; nErr(ii) = size(find([ip- ipHat]), 2); % counting the errors end simBer = nErr/N; % simulated ber

9 Simulation of BPSK in AWGN (2/3)
figure(1) semilogy(Es_N0_dB,simBer,'mx','LineWidth',6); axis([ ^-5 0.5]) xlabel('Es/N0 (dB)') ylabel('Symbol error rate') hold on theoryBerBPSKAWGN = qfunc(sqrt(2*10.^(Es_N0_dB/10))); semilogy(Es_N0_dB,theoryBerBPSKAWGN,'k-','LineWidth',2); legend('AWGN-Simulation','AWGN-Theory');

10 Simulation of BPSK in AWGN (3/3)

11 Γεωμετρική αναπαράσταση σημάτων
Τα σήματα MPSK μπορούν να εκφραστούν ως γραμμικός συνδυασμός των δύο ορθοκανονικών κυματομορφών φ1(t), φ2(t), ως εξής με Τα ανύσματα , για m = 1,2,...,M, αντιστοιχούν σε Μ διαφορετικές κυματομορφές εκπομπής, που δίνονται από τις προβολές Για MPSK (Μ>2)

12 Baseband and Passband signals
M-PSK: σύμβολα εκποπμής I(t)+ j Q(t) signal σε βασική ζώνη (baseband) gΤ(t) κρουστική απόκριση φίλτρου για μορφοποίηση παλμού Στην προσομοίωση μοντελοποιούμε το σήμα σε βασική ζώνη (low-pass equivalent) I(t) + j Q(t) (μιγαδικοί αριθμοί)

13 Baseband and Passband signals
I(t) + j Q(t) (μιγαδικοί αριθμοί) BPSK Q(t) = 0 I(t) = ±1 (or ±A, or ± ) 2 different symbols (bits) QPSK Q(t) = ± 1 I(t) = ±1 4 different symbols (2bits/symbol) 16-QAM Q(t) = ± 1, ±3 I(t) = ±1, ±3 16 different symbols (4 bits/symbol)

14 Διάγραμμα Αστερισμού Υπάρχουν δύο ισοδύναμα διαγράμματα αστερισμού για τον υπολογισμό της πιθανότητας σφάλματος λόγω θορύβου αυτό που αναπαριστά γεωμετρικά τα εκπεμπόμενα σύμβολα και τον αρχικό AWGN θόρυβο με ισχύ αυτό που αναπαριστά την είσοδο στον detector, δηλαδή την τυχαία μεταβλητή z(T), η οποία είναι Gaussian με μέση τιμή που δίνεται από την τιμή του συμβόλου πολλαπλασιασμένη με και διακύμανση

15 Διάγραμμα Αστερισμού g -Ε Ε Region 0 Likelihood of s0 Region 1
Decision Line P[z|s 1 sent] P e (s ) g o Ε

16 QPSK (2-orthogonal 2-PAM) (1/2)
All symbols have transmit energy Generate QPSK symbols in baseband in Matlab alpha4qam = [-1 1]; % 4-QAM alphabets ip = randsrc(1,N,alpha4qam) + j*randsrc(1,N,alpha4qam); s = (1/sqrt(2))*ip; % normalization of energy Es=1

17 QPSK (2-orthogonal 2-PAM) (2/2)
Detection of QPSK symbols in Matlab n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white Gaussian noise, 0dB variance % received symbol with SNR = Es_N0_dB(ii) y = s + 10^(-Es_N0_dB(ii)/20)*n; % demodulation y_re = real(y); % real y_im = imag(y); % imaginary ipHat(find(y_re < 0 & y_im < 0)) = -1 -1*j; ipHat(find(y_re >= 0 & y_im > 0)) = 1 + 1*j; ipHat(find(y_re < 0 & y_im >= 0)) = *j; ipHat(find(y_re >= 0 & y_im < 0)) = 1 - 1*j;

18 16-QAM (2-orthogonal 4-PAM) (1/5)
Parameter should be replaced by in the figure below Observe detection areas!!!

19 16-QAM The symbols for 16-QAM in baseband are
With average energy Es=10 Generate 16-QAM symbols in baseband in Matlab alpha16qam = [ ]; % 16-QAM alphabets ip = randsrc(1,N,alpha16qam) + j*randsrc(1,N,alpha16qam); s = (1/sqrt(10))*ip; % normalization of energy to 1

20 16-QAM Detection of 16-QAM symbols in Matlab
y_re = real(y); % real part y_im = imag(y); % imaginary part ipHat_re(find(y_re< -2/sqrt(10))) = -3; ipHat_re(find(y_re > 2/sqrt(10))) = 3; ipHat_re(find(y_re>-2/sqrt(10) & y_re<=0)) = -1; ipHat_re(find(y_re>0 & y_re<=2/sqrt(10))) = 1; ipHat_im(find(y_im< -2/sqrt(10))) = -3; ipHat_im(find(y_im > 2/sqrt(10))) = 3; ipHat_im(find(y_im>-2/sqrt(10) & y_im<=0)) = -1; ipHat_im(find(y_im>0 & y_im<=2/sqrt(10))) = 1; ipHat = ipHat_re + j*ipHat_im;

21 Προσομοίωση για εύρεση της επίδοσης ψηφιακών διαμορφώσεων
Υπάρχουν οι εξής τρόποι να υπολογίσουμε την μέση πιθανότητα σφάλματος σε ασύρματα κανάλια επικοινωνίας με διάλειψη, δηλαδή να υπολογίσουμε το statistical average όπου είναι η πιθανότητα σφάλματος για συγκεκριμένο SNR γ, π.χ. για BPSK είναι η συνάρτηση πυκνότητας πιθανότητας του SNR, π.χ. για Rayleigh fading έχουμε την εκθετική κατανομή

22 Channel fading distributions
Channel weight h The amplitude of h can follow the general Nakagami-m distribution The instantaneous received SNR will be given by and folow the Gamma distribution In matlab the Gamma distribution is defined by parameters α and b Comparing the above two pdfs, we find α = m and

23 Channel fading distributions
N random variables with the pdf of the SNR with average SNR = hh can be generated using the command gamrnd(m, hh/m, 1, N); A special case of Nakagami-m for m=1 is the Rayleigh pdf and the instantaneous SNR follows the exponential pdf by replacing m=1 in the Gamma pdf Therefore random variables with exponential pdf can be generated using gamrnd(1, hh, 1, N);

24 1ος τρόπος προσομοίωσης
1) δημιουργούμε τυχαίες μεταβλητές με την επιθυμητή κατανομή, 2) υπολογίζουμε τις τιμές της συνάρτησης και 3) υπολογίζουμε τη μέση τιμή (αθροίζουμε τις τιμές και διαιρούμε με τον αριθμό των επαναλήψεων) SNRdB=0:2:30; m=1; % Rayleigh case SNR=10.^(SNRdB/10); % transform from dB to real number % total number of generated random variables per average SNR: N*itr N=500; % create N random variables itr=200; % repeat the experiment for itr times for step=1:itr % step value indicates iteration number for kk= 1:1:length(SNRdB) % kk value indicates average SNR value

25 Statistical average by simulation
hh=SNR(kk); eqv = gamrnd(m, hh/m, 1, N); % create random variable with % Gamma distribution M=4; %QPSK EXACT_qpsk=2.*qfunc(sqrt(eqv))-(qfunc(sqrt(eqv))).^2; ExactQPSK(step,kk)=sum(EXACT_qpsk)/N; M=16; %16-QAM b=3/(M-1); EXACT_qam=(4*(sqrt(M)-1)/sqrt(M))*qfunc(sqrt(b*eqv)) - … (4*(sqrt(M)-1).^2/M).*(qfunc(sqrt(b*eqv))).^2; ExactQAM(step,kk)=sum(EXACT_qam)/N;

26 Statistical average by simulation
end % SNR loop end % iterations loop ExactQPSK=sum(ExactQPSK)/itr ExactQAM=sum(ExactQAM)/itr figure(1) semilogy(SNRdB,ExactQPSK,'x-k',SNRdB,ExactQAM,'o-k') axis([ ^(-4) 10^0]) legend('QPSK', '16-QAM')xlabel('SNR per symbol') ylabel('Average Symbol Error rate')

27 Statistical average by simulation
Result: Symbol error rate versus SNR per symbol

28 2ος τρόπος: απευθείας ολοκλήρωση
2ος τρόπος: απευθείας ολοκλήρωση Για κάθε συνάρτηση πυκνότητας πιθανότητας του SNR, π.χ. για Rayleigh fading έχουμε την εκθετική κατανομή, υπολογίζουμε το ολοκλήρωμα Π.χ. για BPSK έχουμε το integrand function y = integrand_bpsk(gama) global SNR y = qfunc(sqrt(2.*gama)).*(1./SNR).*exp(-gama./SNR);

29 απευθείας ολοκλήρωση Σε νέο αρχείο: clear global SNR SNRdB=0:2:30;
for i=1:length(SNRdB) SNR=10^(SNRdB(i)/10); %from dB to real number 0, 5*SNR, 10^(-8)); end semilogy(SNRdB, pe, '-ob') axis([ ^(-4) 10^0]) xlabel('Average SNR') ylabel('Average BER')

30 απευθείας ολοκλήρωση Result: Bit error rate of BPSK versus SNR per bit

31 Monte Carlo Bit level simulation model Tx Rx Channel Source Encoder
Modulate Decoder Demodulate Detect Tx Rx Spread Despread Format Performance Measure

32 Monte Carlo % Script for computing the BER for BPSK modulation in a
% Rayleigh fading channel  clear N = 10^ % number of bits or symbols  ip = rand(1,N)>0.5; % generating 0,1 with equal probability s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0   Eb_N0_dB = [0:5:35]; % multiple Eb/N0 values

33 Monte Carlo for ii = 1:length(Eb_N0_dB)
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white Gaussian noise, % 0dB variance   h = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % Rayleigh channel % Channel and noise Noise addition y = h.*s + 10^(-Eb_N0_dB(ii)/20)*n;   % equalization yHat = y.*conj(h);  % normalization by the channel power h.*conj(h) % is not necessary for BPSK ! % receiver - hard decision decoding ipHat = real(yHat)>0;  % counting the errors nErr(ii) = size(find([ip- ipHat]),2); end

34 Monte Carlo simBer = nErr/N; % simulated ber % theoretical ber
theoryBerAWGN = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber with fading EbN0Lin = 10.^(Eb_N0_dB/10); theoryBer = 0.5.*(1-sqrt(EbN0Lin./(EbN0Lin+1))); % theoretical ber with fading

35 Monte Carlo Analytical result and simulation result for performance of BPSK in Rayleigh fading … match!!!

36 PDF of maximum SNR Για την μεταβλητή γmax = max(γ1 , γ2 , …, γL) όπου γίνεται επιλογή του καλύτερου SNR μεταξύ L διαφορετικών SNR, το καθένα από τα οποία έχει pdf f(γ), έχουμε: για SNR με εκθετική κατανομή η cdf είναι οπότε

37 PDF of single SNR Η PDF επιβεβαιώνεται και με προσομοίωση. Έστω :
clear; N= ; bins=100; esn0 = 5; % normalized power Ω = 1 rv=(1/sqrt(2))*abs(randn(1,N)+i*randn(1,N)); gama_s = esn0.*rv.^2; [n xout]=hist (gama_s,bins); bar(xout, n/ (N* (max(xout) /bins) ) ) % ! ! ! ! ! axis ([ ] ) hold on

38 PDF of single SNR x=0 : 0.2 : 15; y = (1/esn0).*exp(-x./esn0);
plot (x, y, 'ro' ) legend('simulation', 'theory')


Κατέβασμα ppt "Simulation of Communication Links"

Παρόμοιες παρουσιάσεις


Διαφημίσεις Google