SlideShare a Scribd company logo
ĐẠI HỌC BÁCH KHOA HÀ NỘI
VIỆN ĐIỆN TỬ VIỄN THÔNG
----------
BÁO CÁO THÍ NGHIỆM
THÔNG TIN SỐ
Mã nguồn MATLAB và kết quả mô phỏng
Giảng viên hướng dẫn: Trần Ngọc Tuấn
Sinh viên thực hiện: Nguyễn Minh Đan
MSSV: 20183876
Lớp: CTTN Điện tử truyền thông K63
Mã môn học: ET3250
Nhóm thí nghiệm: TN02
Hà Nội, 07-2021
1
Bài 1. Mô phỏng nhiễu Gauss
% Bai 1.1
x=-5:0.1:5;
Px=(1/(sqrt(2*pi))*exp(-x.^2/2));
plot(x,Px);
% Bai 1.2
len=100000;
x=randn(1,len);
step=.1;
k=-10:step:10;
px=hist(x,k)/len/step;
stem(k,px);
px_lithuyet=exp(-k.^2/2)/sqrt(2*pi);
hold on;
plot(k,px_lithuyet);
title(' Phan bo xac suat Gauss ');
xlabel('x');
ylabel('P(x)');
2
legend('Mo phong', 'Ly thuyet');
hold off;
Bài 2. Kỹ thuật lượng tử hóa tuyến tính
% Ham Linear Quantization - Luong tu hoa tuyen tinh
function [indx, qy] = lquan(x,xmin,xmax,nbit)
nlevel=2^nbit; % So muc luong tu hoa
q=(xmax-xmin)/nlevel; % Buoc luong tu
[indx, qy] = quantiz(x,xmin+q:q:xmax-q,xmin+q/2:q:xmax-q/2);
end
% Bai 2.2
t=0:.01:20;
xt = sin(randn()+t).*cos(rand()*t);
3
[inx, xqt] = lquan(xt,-1,1,randi(3)+1);
plot(t,xt,'b',t,xqt,'r');
title('Luong tu hoa tuyen tinh tin hieu');
xlabel('t');
ylabel('x(t) va xq(t)');
legend('x(t)','xq(t)');
grid on;
Bài 3. Tạp âm lượng tử trong kỹ thuật lượng tử hóa tuyến tính
% Bai 3
N = 1000;
x_uni = 2*rand(1,N)-1;
x_sin = sin(linspace(1,5,N));
nbit = 1:10;
SNqR_uni = zeros(size(nbit));
4
SNqR_sin = zeros(size(nbit));
SNqR_lt = 6.02*nbit;
Ps_uni = sum(x_uni.^2)/N;
Ps_sin = sum(x_sin.^2)/N;
for i=1:size(nbit,2)
[indx1, qy1] = lquan(x_uni,-1,1,nbit(i));
[indx2, qy2] = lquan(x_sin,-1,1,nbit(i));
eq_uni = x_uni-qy1;
eq_sin = x_sin-qy2;
Pq_uni = (1/N)*sum(abs(eq_uni).^2);
Pq_sin = (1/N)*sum(abs(eq_sin).^2);
SNqR_uni(i)=10*log10(Ps_uni/Pq_uni);
SNqR_sin(i)=10*log10(Ps_sin/Pq_sin);
end
stem(nbit,SNqR_uni, 'b'); % blue
hold on;
stem(nbit,SNqR_sin,'r'); % red
hold on;
stem(nbit,SNqR_lt,'m'); % magenta
xlabel('nbit');
ylabel('SNqR');
title('Ty so tin hieu tren tap am luong tu trong luong tu hoa tuyen tinh')
legend('SNqR_u_n_i','SNqR_s_i_n','SNqR_l_t', 'Location', 'northwest');
5
Bài 4. Mật độ phổ năng lượng và hàm tự tương quan của tín hiệu
% Bai 4.1
L = 500;
x = randn(1,L); % TH 1
% x = linspace(-1,1,L); % TH 2
% x = sin(linspace(-10,10,L)); % TH 3
acorr_x = xcorr(x);
n = -(L-1):L-1;
plot(n,acorr_x);
title('Do thi ham tu tuong quan');
xlabel('x');
ylabel('r_x_x');
6
7
% Bai 4.2
L = 50; % Do dai tin hieu
N = 200; % So luong cac tan so roi rac trong khoang 0 den 2*pi
x = rand(1,L); % Tao tin hieu ngau nhien
w = linspace(0,2*pi,N); % Tao N tan so tang dan tu 0 den 2*pi
fx = freqz(x,1,w); % Bien doi Fourier cua x tai cac tan so roi rac
esd_x = fx.*conj(fx); % Tinh ham mat do pho nang luong
acorr_x = xcorr(x); % Tinh ham tu tuong quan cua tin hieu x
ft_acorr_x = freqz(acorr_x,1,w).*exp(j*w*(L-1)); % Bien doi Fourier cua
ham tu tuong quan cua tin hieu x
% Ve do thi
subplot(2,1,1);
semilogy(w/pi,esd_x);
title('Do thi mat do pho nang luong');
xlabel('w');
8
ylabel('S(e^j^omega)')
hold on;
subplot(2,1,2);
semilogy(w/pi,real(ft_acorr_x),'r');
title('Do thi pho ham tu tuong quan');
xlabel('w');
ylabel('R_x_x(e^j^omega)');
hold off;
9
Bài 5. Mã đường dây NRZ
% Bai 5
len = 100000; % Do dai dong bit mo phong
SNR_db = 0:2:8; % Tao vector SNR_db = 0 2 4 6 8
SNR = 10.^(SNR_db/10); % Doi SNR tu Decibel sang lan
bsignal = randi([0 1],1,len); % Dong bit ngau nhien voi do dai len
NRZ_signal = bsignal*2-1; % Bien doi dong bit 0 1 sang -1 1
N0 = 1./SNR; % Cong suat tap am
for i=1:length(SNR_db)
noise = sqrt(N0(i))*randn(1,len); % Tao tap am noise voi ti so SNR(i)
r_signal = NRZ_signal + noise; % Tin hieu thu duoc = NRZ + noise
NRZ_decoded = sign(r_signal); % Giai ma tin hieu NRZ thu duoc
[n,BER(i)] = symerr(NRZ_decoded,NRZ_signal); % Tinh xac suat loi
end
plot(SNR_db,BER,'bo--');
Pe = 1/2*(1-erf(sqrt(SNR)/sqrt(2))); % Xac suat loi theo ly thuyet
hold on;
plot(SNR_db,Pe,'r*--'); % Ve do thi Pe
title('Do thi ty le loi bit BER theo ly thuyet va mo phong');
xlabel('SNR_d_B');
ylabel('BER');
legend('Mo phong','Ly thuyet');
10
Bài 6. Kỹ thuật điều chế số QPSK
% Bai 6
len = 50000; % Do dai dong bit mo phong
SNR_db = 0; % SNR co don vi Decibel
% SNR_db = 3; % Thay doi SNR = 3 dB
% SNR_db = 6; % Thay doi SNR = 6 dB
SNR = 10^(SNR_db/10); % Doi SNR tu Decibel sang lan
bsignal = randi([0 1],1,len); % Tao dong bit ngau nhien do dai len
% Bat dau thuc hien dieu che QPSK
for i=1:2:len
if bsignal(i)==0 & bsignal(i+1)==0 % cap bit 00
qpsk_signal((i+1)/2) = exp(j*3*pi/4);
elseif bsignal(i)==0 & bsignal(i+1)==1 % cap bit 01
qpsk_signal((i+1)/2) = exp(j*5*pi/4);
11
elseif bsignal(i)==1 & bsignal(i+1)==1 % cap bit 11
qpsk_signal((i+1)/2) = exp(j*7*pi/4);
elseif bsignal(i)==1 & bsignal(i+1)==0 % cap bit 10
qpsk_signal((i+1)/2) = exp(j*pi/4);
end
end
Es = std(qpsk_signal)^2; % Nang luong ky hieu
N0 = Es/SNR; % Cong suat tap am
% Tao nhieu Gauss
noise =
sqrt(N0/2)*(randn(1,length(qpsk_signal))+j*randn(1,length(qpsk_signal)));
qpsk_awgn = qpsk_signal + noise; % Cho tin hieu dieu che di qua kenh AWGN
plot(qpsk_awgn,'.'); % Ve chom sao tin hieu co nhieu
title('Do thi chom sao 4-QPSK (SNR=0dB)');
xlabel('I');
ylabel('Q');
hold on;
plot(qpsk_signal,'r*'); % Ve chom sao tin hieu khong nhieu
plot(exp(j*[0:0.01:2*pi]),'r--');
12
13
Bài 7. Xác suất lỗi bit trong điều chế QPSK
% Bai 7
len = 50000; % Do dai dong bit mo phong
SNR_db = 0:2:8; % Tao vector SNR_db = 0 2 4 6 8
SNR = 10.^(SNR_db/10); % Doi SNR tu Decibel sang lan
bsignal = randi([0 1],1,len); % Tao dong bit ngau nhien do dai len
% Thuc hien dieu che QPSK
for i=1:2:len
if bsignal(i)==0 & bsignal(i+1)==0 % cap bit 00
qpsk_signal((i+1)/2) = exp(j*3*pi/4);
elseif bsignal(i)==0 & bsignal(i+1)==1 % cap bit 01
qpsk_signal((i+1)/2) = exp(j*5*pi/4);
elseif bsignal(i)==1 & bsignal(i+1)==1 % cap bit 11
qpsk_signal((i+1)/2) = exp(j*7*pi/4);
elseif bsignal(i)==1 & bsignal(i+1)==0 % cap bit 10
qpsk_signal((i+1)/2) = exp(j*pi/4);
end
end
% Tim BER mo phong
for i=1:length(SNR_db)
r_signal = awgn(qpsk_signal,SNR_db(i)); % Dieu che QPSK di qua nhieu AWGN
for j=1:2:len % Giai dieu che tin hieu QPSK co nhieu
if real(r_signal((j+1)/2))>=0
if imag(r_signal((j+1)/2))>=0 % Goc phan tu I
r_bsignal(j) = 1;
r_bsignal(j+1) = 0;
else % Goc phan tu IV
r_bsignal(j) = 1;
r_bsignal(j+1) = 1;
end
else
if imag(r_signal((j+1)/2))>=0 % Goc phan tu II
r_bsignal(j) = 0;
r_bsignal(j+1) = 0;
else % Goc phan tu III
r_bsignal(j) = 0;
r_bsignal(j+1) = 1;
end
end
14
end
[n,BER(i)] = biterr(r_bsignal,bsignal);
end
Pb = 1/2*erfc(1/sqrt(2).*sqrt(SNR)); % Xac suat loi bit
plot(SNR_db,Pb,'ro--'); % Ve do thi Pb ly thuyet
title('Do thi ty le bit loi BER ly thuyet va mo phong');
xlabel('SNR_d_B');
ylabel('BER');
hold on;
plot(SNR_db,BER); % Ve do thi BER mo phong
legend('Ly thuyet','Mo phong');
hold off;
15
Bài 8. Mô phỏng điều chế M-QAM qua kênh nhiễu Gauss
% Bai 8.1
n_sym = 50000; % So ky tu dieu che
M = [16 64 256]; % So symbol ky hieu
SNR_db = 0:25; % Tao vector SNR = 0 - 25 Decibel
BER = zeros(length(M),length(SNR_db)); % BER de luu ti le loi bit
for k = 1:size(M,2) % size(M,2) la so cot cua M
s_stream = randi([0 M(k)-1],1,n_sym); % Tao dong bieu tuong do
dai n_sym
s_mod = qammod(s_stream,M(k),'GRAY'); % Dieu che M-QAM
for r = 1:size(SNR_db,2) % Vong lap tinh BER
s_mod_awgn = awgn(s_mod,SNR_db(r),'measured'); % Tin hieu qua nhieu
s_demod = qamdemod(s_mod_awgn,M(k),'GRAY'); % Giai dieu che M-QAM
[num, ratio] = biterr(s_stream,s_demod); % Tinh ti le loi bit
BER(k,r) = ratio; % Luu ti le loi bit vao BER
end
end
semilogy(SNR_db,BER(1,:),'gx', 'LineStyle', 'none'); % Ve do thi BER voi M
= 16
hold on;
semilogy(SNR_db,BER(2,:),'ro', 'LineStyle', 'none'); % Ve do thi BER voi M
= 64
semilogy(SNR_db,BER(3,:),'b*', 'LineStyle', 'none'); % Ve do thi BER voi M
= 256
grid on;
BER_lt = zeros(length(M),length(SNR_db));
for i = 1:length(M)
BER_lt(i,:) = berawgn(SNR_db - 10*log10(log2(M(i))),'qam',M(i));
end
semilogy(SNR_db,BER_lt(1,:),'g-'); % Ve do thi BER ly
thuyet voi M = 16
semilogy(SNR_db,BER_lt(2,:),'r-'); % Ve do thi BER ly
thuyet voi M = 64
semilogy(SNR_db,BER_lt(3,:),'b-'); % Ve do thi BER ly
thuyet voi M = 256
title('Do thi ty le loi bit mo phong va ly thuyet cua ky thuat M-QAM');
xlabel('SNR_d_B');
16
ylabel('BER/Pe');
legend('BER 16-QAM','BER 64-QAM','BER 256-QAM','Pe 16-QAM','Pe 64-QAM','Pe
256-QAM', 'Location', 'southwest');
hold off;

More Related Content

What's hot

Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)anithabalaprabhu
 
Simulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_systemSimulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_system
maheshwareshwar
 
Matlab 2
Matlab 2Matlab 2
Matlab 2asguna
 
Matlab programs
Matlab programsMatlab programs
Matlab programs
Prakash Rout
 

What's hot (6)

Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)
 
06 Arithmetic 1
06 Arithmetic 106 Arithmetic 1
06 Arithmetic 1
 
Digfilt
DigfiltDigfilt
Digfilt
 
Simulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_systemSimulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_system
 
Matlab 2
Matlab 2Matlab 2
Matlab 2
 
Matlab programs
Matlab programsMatlab programs
Matlab programs
 

Similar to Tb16 nguyễn minhđan_20183876

Please use the same variables and only write the TODO part #!-usr-bi.pdf
Please use the same variables and only write the TODO part   #!-usr-bi.pdfPlease use the same variables and only write the TODO part   #!-usr-bi.pdf
Please use the same variables and only write the TODO part #!-usr-bi.pdf
asenterprisestyagi
 
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdfUse the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
acteleshoppe
 
QFSK: BER and SER Derivation and Simulation
QFSK: BER and SER Derivation and SimulationQFSK: BER and SER Derivation and Simulation
QFSK: BER and SER Derivation and Simulation
Tom Cruz
 
Section6 stochastic
Section6 stochasticSection6 stochastic
Section6 stochastic
cairo university
 
Fourier series example
Fourier series exampleFourier series example
Fourier series exampleAbi finni
 
The Moore-Spiegel Oscillator
The Moore-Spiegel OscillatorThe Moore-Spiegel Oscillator
The Moore-Spiegel Oscillator
Abhranil Das
 
Digitla Communication pulse shaping filter
Digitla Communication pulse shaping filterDigitla Communication pulse shaping filter
Digitla Communication pulse shaping filtermirfanjum
 
matlab.docx
matlab.docxmatlab.docx
Computational Method to Solve the Partial Differential Equations (PDEs)
Computational Method to Solve the Partial Differential  Equations (PDEs)Computational Method to Solve the Partial Differential  Equations (PDEs)
Computational Method to Solve the Partial Differential Equations (PDEs)
Dr. Khurram Mehboob
 
Main code
Main codeMain code
Main code
Punit Karnani
 
Matlab kod taslağı
Matlab kod taslağıMatlab kod taslağı
Matlab kod taslağıMerve Cvdr
 
EEL316: CDMA with DSSS
EEL316: CDMA with DSSSEEL316: CDMA with DSSS
EEL316: CDMA with DSSS
Umang Gupta
 
bask, bfsk, bpsk
bask, bfsk, bpskbask, bfsk, bpsk
bask, bfsk, bpsk
blzz2net
 
EEL316: ASK
EEL316: ASKEEL316: ASK
EEL316: ASK
Umang Gupta
 
Experiment3_DCS-21BEC0384Adityabonnerjee
Experiment3_DCS-21BEC0384AdityabonnerjeeExperiment3_DCS-21BEC0384Adityabonnerjee
Experiment3_DCS-21BEC0384Adityabonnerjee
AdityaBonnerjee21BEC
 
Dsp manual
Dsp manualDsp manual
Dsp manual
pramod naik
 
Modulation techniques matlab_code
Modulation techniques matlab_codeModulation techniques matlab_code
Modulation techniques matlab_code
Вахидреза Мохсени
 
A MODIFIED DIRECTIONAL WEIGHTED CASCADED-MASK MEDIAN FILTER FOR REMOVAL OF RA...
A MODIFIED DIRECTIONAL WEIGHTED CASCADED-MASK MEDIAN FILTER FOR REMOVAL OF RA...A MODIFIED DIRECTIONAL WEIGHTED CASCADED-MASK MEDIAN FILTER FOR REMOVAL OF RA...
A MODIFIED DIRECTIONAL WEIGHTED CASCADED-MASK MEDIAN FILTER FOR REMOVAL OF RA...
cscpconf
 
Cs580
Cs580Cs580

Similar to Tb16 nguyễn minhđan_20183876 (20)

Please use the same variables and only write the TODO part #!-usr-bi.pdf
Please use the same variables and only write the TODO part   #!-usr-bi.pdfPlease use the same variables and only write the TODO part   #!-usr-bi.pdf
Please use the same variables and only write the TODO part #!-usr-bi.pdf
 
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdfUse the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
 
QFSK: BER and SER Derivation and Simulation
QFSK: BER and SER Derivation and SimulationQFSK: BER and SER Derivation and Simulation
QFSK: BER and SER Derivation and Simulation
 
Section6 stochastic
Section6 stochasticSection6 stochastic
Section6 stochastic
 
Fourier series example
Fourier series exampleFourier series example
Fourier series example
 
The Moore-Spiegel Oscillator
The Moore-Spiegel OscillatorThe Moore-Spiegel Oscillator
The Moore-Spiegel Oscillator
 
Digitla Communication pulse shaping filter
Digitla Communication pulse shaping filterDigitla Communication pulse shaping filter
Digitla Communication pulse shaping filter
 
matlab.docx
matlab.docxmatlab.docx
matlab.docx
 
Computational Method to Solve the Partial Differential Equations (PDEs)
Computational Method to Solve the Partial Differential  Equations (PDEs)Computational Method to Solve the Partial Differential  Equations (PDEs)
Computational Method to Solve the Partial Differential Equations (PDEs)
 
Main code
Main codeMain code
Main code
 
Matlab kod taslağı
Matlab kod taslağıMatlab kod taslağı
Matlab kod taslağı
 
Numerical methods generating polynomial
Numerical methods generating polynomialNumerical methods generating polynomial
Numerical methods generating polynomial
 
EEL316: CDMA with DSSS
EEL316: CDMA with DSSSEEL316: CDMA with DSSS
EEL316: CDMA with DSSS
 
bask, bfsk, bpsk
bask, bfsk, bpskbask, bfsk, bpsk
bask, bfsk, bpsk
 
EEL316: ASK
EEL316: ASKEEL316: ASK
EEL316: ASK
 
Experiment3_DCS-21BEC0384Adityabonnerjee
Experiment3_DCS-21BEC0384AdityabonnerjeeExperiment3_DCS-21BEC0384Adityabonnerjee
Experiment3_DCS-21BEC0384Adityabonnerjee
 
Dsp manual
Dsp manualDsp manual
Dsp manual
 
Modulation techniques matlab_code
Modulation techniques matlab_codeModulation techniques matlab_code
Modulation techniques matlab_code
 
A MODIFIED DIRECTIONAL WEIGHTED CASCADED-MASK MEDIAN FILTER FOR REMOVAL OF RA...
A MODIFIED DIRECTIONAL WEIGHTED CASCADED-MASK MEDIAN FILTER FOR REMOVAL OF RA...A MODIFIED DIRECTIONAL WEIGHTED CASCADED-MASK MEDIAN FILTER FOR REMOVAL OF RA...
A MODIFIED DIRECTIONAL WEIGHTED CASCADED-MASK MEDIAN FILTER FOR REMOVAL OF RA...
 
Cs580
Cs580Cs580
Cs580
 

More from NgGiaHi

Toan hn de_full
Toan hn de_fullToan hn de_full
Toan hn de_full
NgGiaHi
 
Toan hn de_1-13
Toan hn de_1-13Toan hn de_1-13
Toan hn de_1-13
NgGiaHi
 
Toan hn da_full
Toan hn da_fullToan hn da_full
Toan hn da_full
NgGiaHi
 
Toán hn 2021
Toán hn 2021Toán hn 2021
Toán hn 2021
NgGiaHi
 
Toán hn 2020
Toán hn 2020Toán hn 2020
Toán hn 2020
NgGiaHi
 
Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876
NgGiaHi
 
Slide nhom07
Slide nhom07Slide nhom07
Slide nhom07
NgGiaHi
 
Ltmmsdsds
LtmmsdsdsLtmmsdsds
Ltmmsdsds
NgGiaHi
 
Learn aessdsds
Learn aessdsdsLearn aessdsds
Learn aessdsds
NgGiaHi
 
Bài tập condition 1
Bài tập condition 1 Bài tập condition 1
Bài tập condition 1
NgGiaHi
 
Bài tập condition 1
Bài tập condition 1 Bài tập condition 1
Bài tập condition 1
NgGiaHi
 

More from NgGiaHi (11)

Toan hn de_full
Toan hn de_fullToan hn de_full
Toan hn de_full
 
Toan hn de_1-13
Toan hn de_1-13Toan hn de_1-13
Toan hn de_1-13
 
Toan hn da_full
Toan hn da_fullToan hn da_full
Toan hn da_full
 
Toán hn 2021
Toán hn 2021Toán hn 2021
Toán hn 2021
 
Toán hn 2020
Toán hn 2020Toán hn 2020
Toán hn 2020
 
Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876Tb16 nguyễn minhđan_20183876
Tb16 nguyễn minhđan_20183876
 
Slide nhom07
Slide nhom07Slide nhom07
Slide nhom07
 
Ltmmsdsds
LtmmsdsdsLtmmsdsds
Ltmmsdsds
 
Learn aessdsds
Learn aessdsdsLearn aessdsds
Learn aessdsds
 
Bài tập condition 1
Bài tập condition 1 Bài tập condition 1
Bài tập condition 1
 
Bài tập condition 1
Bài tập condition 1 Bài tập condition 1
Bài tập condition 1
 

Recently uploaded

Immunity to Veterinary parasitic infections power point presentation
Immunity to Veterinary parasitic infections power point presentationImmunity to Veterinary parasitic infections power point presentation
Immunity to Veterinary parasitic infections power point presentation
BeshedaWedajo
 
Leading the Way in Nephrology: Dr. David Greene's Work with Stem Cells for Ki...
Leading the Way in Nephrology: Dr. David Greene's Work with Stem Cells for Ki...Leading the Way in Nephrology: Dr. David Greene's Work with Stem Cells for Ki...
Leading the Way in Nephrology: Dr. David Greene's Work with Stem Cells for Ki...
Dr. David Greene Arizona
 
Haridwar ❤CALL Girls 🔝 89011★83002 🔝 ❤ℂall Girls IN Haridwar ESCORT SERVICE❤
Haridwar ❤CALL Girls 🔝 89011★83002 🔝 ❤ℂall Girls IN Haridwar ESCORT SERVICE❤Haridwar ❤CALL Girls 🔝 89011★83002 🔝 ❤ℂall Girls IN Haridwar ESCORT SERVICE❤
Haridwar ❤CALL Girls 🔝 89011★83002 🔝 ❤ℂall Girls IN Haridwar ESCORT SERVICE❤
ranishasharma67
 
QA Paediatric dentistry department, Hospital Melaka 2020
QA Paediatric dentistry department, Hospital Melaka 2020QA Paediatric dentistry department, Hospital Melaka 2020
QA Paediatric dentistry department, Hospital Melaka 2020
Azreen Aj
 
Contact Now 89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...
Contact Now  89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...Contact Now  89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...
Contact Now 89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...
aunty1x2
 
Performance Standards for Antimicrobial Susceptibility Testing
Performance Standards for Antimicrobial Susceptibility TestingPerformance Standards for Antimicrobial Susceptibility Testing
Performance Standards for Antimicrobial Susceptibility Testing
Nguyễn Thị Vân Anh
 
R3 Stem Cells and Kidney Repair A New Horizon in Nephrology.pptx
R3 Stem Cells and Kidney Repair A New Horizon in Nephrology.pptxR3 Stem Cells and Kidney Repair A New Horizon in Nephrology.pptx
R3 Stem Cells and Kidney Repair A New Horizon in Nephrology.pptx
R3 Stem Cell
 
Navigating the Health Insurance Market_ Understanding Trends and Options.pdf
Navigating the Health Insurance Market_ Understanding Trends and Options.pdfNavigating the Health Insurance Market_ Understanding Trends and Options.pdf
Navigating the Health Insurance Market_ Understanding Trends and Options.pdf
Enterprise Wired
 
Jaipur ❤cALL gIRLS 89O1183002 ❤ℂall Girls IN JaiPuR ESCORT SERVICE
Jaipur ❤cALL gIRLS 89O1183002 ❤ℂall Girls IN JaiPuR ESCORT SERVICEJaipur ❤cALL gIRLS 89O1183002 ❤ℂall Girls IN JaiPuR ESCORT SERVICE
Jaipur ❤cALL gIRLS 89O1183002 ❤ℂall Girls IN JaiPuR ESCORT SERVICE
ranishasharma67
 
VVIP Dehradun Girls 9719300533 Heat-bake { Dehradun } Genteel ℂall Serviℂe By...
VVIP Dehradun Girls 9719300533 Heat-bake { Dehradun } Genteel ℂall Serviℂe By...VVIP Dehradun Girls 9719300533 Heat-bake { Dehradun } Genteel ℂall Serviℂe By...
VVIP Dehradun Girls 9719300533 Heat-bake { Dehradun } Genteel ℂall Serviℂe By...
rajkumar669520
 
💘Ludhiana ℂall Girls 📞]][89011★83002][[ 📱 ❤ESCORTS service in Ludhiana💃💦Ludhi...
💘Ludhiana ℂall Girls 📞]][89011★83002][[ 📱 ❤ESCORTS service in Ludhiana💃💦Ludhi...💘Ludhiana ℂall Girls 📞]][89011★83002][[ 📱 ❤ESCORTS service in Ludhiana💃💦Ludhi...
💘Ludhiana ℂall Girls 📞]][89011★83002][[ 📱 ❤ESCORTS service in Ludhiana💃💦Ludhi...
ranishasharma67
 
ABDOMINAL COMPARTMENT SYSNDROME
ABDOMINAL COMPARTMENT SYSNDROMEABDOMINAL COMPARTMENT SYSNDROME
ABDOMINAL COMPARTMENT SYSNDROME
Rommel Luis III Israel
 
Dehradun ❤CALL Girls 8901183002 ❤ℂall Girls IN Dehradun ESCORT SERVICE❤
Dehradun ❤CALL Girls  8901183002 ❤ℂall  Girls IN Dehradun ESCORT SERVICE❤Dehradun ❤CALL Girls  8901183002 ❤ℂall  Girls IN Dehradun ESCORT SERVICE❤
Dehradun ❤CALL Girls 8901183002 ❤ℂall Girls IN Dehradun ESCORT SERVICE❤
aunty1x2
 
Secret Tantric VIP Erotic Massage London
Secret Tantric VIP Erotic Massage LondonSecret Tantric VIP Erotic Massage London
Secret Tantric VIP Erotic Massage London
Secret Tantric - VIP Erotic Massage London
 
Myopia Management & Control Strategies.pptx
Myopia Management & Control Strategies.pptxMyopia Management & Control Strategies.pptx
Myopia Management & Control Strategies.pptx
RitonDeb1
 
Anatomy and Physiology Chapter-16_Digestive-System.pptx
Anatomy and Physiology Chapter-16_Digestive-System.pptxAnatomy and Physiology Chapter-16_Digestive-System.pptx
Anatomy and Physiology Chapter-16_Digestive-System.pptx
shanicedivinagracia2
 
Surgery-Mini-OSCE-All-Past-Years-Questions-Modified.
Surgery-Mini-OSCE-All-Past-Years-Questions-Modified.Surgery-Mini-OSCE-All-Past-Years-Questions-Modified.
Surgery-Mini-OSCE-All-Past-Years-Questions-Modified.
preciousstephanie75
 
The Docs PPG - 30.05.2024.pptx..........
The Docs PPG - 30.05.2024.pptx..........The Docs PPG - 30.05.2024.pptx..........
The Docs PPG - 30.05.2024.pptx..........
TheDocs
 
Navigating Challenges: Mental Health, Legislation, and the Prison System in B...
Navigating Challenges: Mental Health, Legislation, and the Prison System in B...Navigating Challenges: Mental Health, Legislation, and the Prison System in B...
Navigating Challenges: Mental Health, Legislation, and the Prison System in B...
Guillermo Rivera
 
Navigating Healthcare with Telemedicine
Navigating Healthcare with  TelemedicineNavigating Healthcare with  Telemedicine
Navigating Healthcare with Telemedicine
Iris Thiele Isip-Tan
 

Recently uploaded (20)

Immunity to Veterinary parasitic infections power point presentation
Immunity to Veterinary parasitic infections power point presentationImmunity to Veterinary parasitic infections power point presentation
Immunity to Veterinary parasitic infections power point presentation
 
Leading the Way in Nephrology: Dr. David Greene's Work with Stem Cells for Ki...
Leading the Way in Nephrology: Dr. David Greene's Work with Stem Cells for Ki...Leading the Way in Nephrology: Dr. David Greene's Work with Stem Cells for Ki...
Leading the Way in Nephrology: Dr. David Greene's Work with Stem Cells for Ki...
 
Haridwar ❤CALL Girls 🔝 89011★83002 🔝 ❤ℂall Girls IN Haridwar ESCORT SERVICE❤
Haridwar ❤CALL Girls 🔝 89011★83002 🔝 ❤ℂall Girls IN Haridwar ESCORT SERVICE❤Haridwar ❤CALL Girls 🔝 89011★83002 🔝 ❤ℂall Girls IN Haridwar ESCORT SERVICE❤
Haridwar ❤CALL Girls 🔝 89011★83002 🔝 ❤ℂall Girls IN Haridwar ESCORT SERVICE❤
 
QA Paediatric dentistry department, Hospital Melaka 2020
QA Paediatric dentistry department, Hospital Melaka 2020QA Paediatric dentistry department, Hospital Melaka 2020
QA Paediatric dentistry department, Hospital Melaka 2020
 
Contact Now 89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...
Contact Now  89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...Contact Now  89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...
Contact Now 89011**83002 Dehradun ℂall Girls By Full Service ℂall Girl In De...
 
Performance Standards for Antimicrobial Susceptibility Testing
Performance Standards for Antimicrobial Susceptibility TestingPerformance Standards for Antimicrobial Susceptibility Testing
Performance Standards for Antimicrobial Susceptibility Testing
 
R3 Stem Cells and Kidney Repair A New Horizon in Nephrology.pptx
R3 Stem Cells and Kidney Repair A New Horizon in Nephrology.pptxR3 Stem Cells and Kidney Repair A New Horizon in Nephrology.pptx
R3 Stem Cells and Kidney Repair A New Horizon in Nephrology.pptx
 
Navigating the Health Insurance Market_ Understanding Trends and Options.pdf
Navigating the Health Insurance Market_ Understanding Trends and Options.pdfNavigating the Health Insurance Market_ Understanding Trends and Options.pdf
Navigating the Health Insurance Market_ Understanding Trends and Options.pdf
 
Jaipur ❤cALL gIRLS 89O1183002 ❤ℂall Girls IN JaiPuR ESCORT SERVICE
Jaipur ❤cALL gIRLS 89O1183002 ❤ℂall Girls IN JaiPuR ESCORT SERVICEJaipur ❤cALL gIRLS 89O1183002 ❤ℂall Girls IN JaiPuR ESCORT SERVICE
Jaipur ❤cALL gIRLS 89O1183002 ❤ℂall Girls IN JaiPuR ESCORT SERVICE
 
VVIP Dehradun Girls 9719300533 Heat-bake { Dehradun } Genteel ℂall Serviℂe By...
VVIP Dehradun Girls 9719300533 Heat-bake { Dehradun } Genteel ℂall Serviℂe By...VVIP Dehradun Girls 9719300533 Heat-bake { Dehradun } Genteel ℂall Serviℂe By...
VVIP Dehradun Girls 9719300533 Heat-bake { Dehradun } Genteel ℂall Serviℂe By...
 
💘Ludhiana ℂall Girls 📞]][89011★83002][[ 📱 ❤ESCORTS service in Ludhiana💃💦Ludhi...
💘Ludhiana ℂall Girls 📞]][89011★83002][[ 📱 ❤ESCORTS service in Ludhiana💃💦Ludhi...💘Ludhiana ℂall Girls 📞]][89011★83002][[ 📱 ❤ESCORTS service in Ludhiana💃💦Ludhi...
💘Ludhiana ℂall Girls 📞]][89011★83002][[ 📱 ❤ESCORTS service in Ludhiana💃💦Ludhi...
 
ABDOMINAL COMPARTMENT SYSNDROME
ABDOMINAL COMPARTMENT SYSNDROMEABDOMINAL COMPARTMENT SYSNDROME
ABDOMINAL COMPARTMENT SYSNDROME
 
Dehradun ❤CALL Girls 8901183002 ❤ℂall Girls IN Dehradun ESCORT SERVICE❤
Dehradun ❤CALL Girls  8901183002 ❤ℂall  Girls IN Dehradun ESCORT SERVICE❤Dehradun ❤CALL Girls  8901183002 ❤ℂall  Girls IN Dehradun ESCORT SERVICE❤
Dehradun ❤CALL Girls 8901183002 ❤ℂall Girls IN Dehradun ESCORT SERVICE❤
 
Secret Tantric VIP Erotic Massage London
Secret Tantric VIP Erotic Massage LondonSecret Tantric VIP Erotic Massage London
Secret Tantric VIP Erotic Massage London
 
Myopia Management & Control Strategies.pptx
Myopia Management & Control Strategies.pptxMyopia Management & Control Strategies.pptx
Myopia Management & Control Strategies.pptx
 
Anatomy and Physiology Chapter-16_Digestive-System.pptx
Anatomy and Physiology Chapter-16_Digestive-System.pptxAnatomy and Physiology Chapter-16_Digestive-System.pptx
Anatomy and Physiology Chapter-16_Digestive-System.pptx
 
Surgery-Mini-OSCE-All-Past-Years-Questions-Modified.
Surgery-Mini-OSCE-All-Past-Years-Questions-Modified.Surgery-Mini-OSCE-All-Past-Years-Questions-Modified.
Surgery-Mini-OSCE-All-Past-Years-Questions-Modified.
 
The Docs PPG - 30.05.2024.pptx..........
The Docs PPG - 30.05.2024.pptx..........The Docs PPG - 30.05.2024.pptx..........
The Docs PPG - 30.05.2024.pptx..........
 
Navigating Challenges: Mental Health, Legislation, and the Prison System in B...
Navigating Challenges: Mental Health, Legislation, and the Prison System in B...Navigating Challenges: Mental Health, Legislation, and the Prison System in B...
Navigating Challenges: Mental Health, Legislation, and the Prison System in B...
 
Navigating Healthcare with Telemedicine
Navigating Healthcare with  TelemedicineNavigating Healthcare with  Telemedicine
Navigating Healthcare with Telemedicine
 

Tb16 nguyễn minhđan_20183876

  • 1. ĐẠI HỌC BÁCH KHOA HÀ NỘI VIỆN ĐIỆN TỬ VIỄN THÔNG ---------- BÁO CÁO THÍ NGHIỆM THÔNG TIN SỐ Mã nguồn MATLAB và kết quả mô phỏng Giảng viên hướng dẫn: Trần Ngọc Tuấn Sinh viên thực hiện: Nguyễn Minh Đan MSSV: 20183876 Lớp: CTTN Điện tử truyền thông K63 Mã môn học: ET3250 Nhóm thí nghiệm: TN02 Hà Nội, 07-2021
  • 2. 1 Bài 1. Mô phỏng nhiễu Gauss % Bai 1.1 x=-5:0.1:5; Px=(1/(sqrt(2*pi))*exp(-x.^2/2)); plot(x,Px); % Bai 1.2 len=100000; x=randn(1,len); step=.1; k=-10:step:10; px=hist(x,k)/len/step; stem(k,px); px_lithuyet=exp(-k.^2/2)/sqrt(2*pi); hold on; plot(k,px_lithuyet); title(' Phan bo xac suat Gauss '); xlabel('x'); ylabel('P(x)');
  • 3. 2 legend('Mo phong', 'Ly thuyet'); hold off; Bài 2. Kỹ thuật lượng tử hóa tuyến tính % Ham Linear Quantization - Luong tu hoa tuyen tinh function [indx, qy] = lquan(x,xmin,xmax,nbit) nlevel=2^nbit; % So muc luong tu hoa q=(xmax-xmin)/nlevel; % Buoc luong tu [indx, qy] = quantiz(x,xmin+q:q:xmax-q,xmin+q/2:q:xmax-q/2); end % Bai 2.2 t=0:.01:20; xt = sin(randn()+t).*cos(rand()*t);
  • 4. 3 [inx, xqt] = lquan(xt,-1,1,randi(3)+1); plot(t,xt,'b',t,xqt,'r'); title('Luong tu hoa tuyen tinh tin hieu'); xlabel('t'); ylabel('x(t) va xq(t)'); legend('x(t)','xq(t)'); grid on; Bài 3. Tạp âm lượng tử trong kỹ thuật lượng tử hóa tuyến tính % Bai 3 N = 1000; x_uni = 2*rand(1,N)-1; x_sin = sin(linspace(1,5,N)); nbit = 1:10; SNqR_uni = zeros(size(nbit));
  • 5. 4 SNqR_sin = zeros(size(nbit)); SNqR_lt = 6.02*nbit; Ps_uni = sum(x_uni.^2)/N; Ps_sin = sum(x_sin.^2)/N; for i=1:size(nbit,2) [indx1, qy1] = lquan(x_uni,-1,1,nbit(i)); [indx2, qy2] = lquan(x_sin,-1,1,nbit(i)); eq_uni = x_uni-qy1; eq_sin = x_sin-qy2; Pq_uni = (1/N)*sum(abs(eq_uni).^2); Pq_sin = (1/N)*sum(abs(eq_sin).^2); SNqR_uni(i)=10*log10(Ps_uni/Pq_uni); SNqR_sin(i)=10*log10(Ps_sin/Pq_sin); end stem(nbit,SNqR_uni, 'b'); % blue hold on; stem(nbit,SNqR_sin,'r'); % red hold on; stem(nbit,SNqR_lt,'m'); % magenta xlabel('nbit'); ylabel('SNqR'); title('Ty so tin hieu tren tap am luong tu trong luong tu hoa tuyen tinh') legend('SNqR_u_n_i','SNqR_s_i_n','SNqR_l_t', 'Location', 'northwest');
  • 6. 5 Bài 4. Mật độ phổ năng lượng và hàm tự tương quan của tín hiệu % Bai 4.1 L = 500; x = randn(1,L); % TH 1 % x = linspace(-1,1,L); % TH 2 % x = sin(linspace(-10,10,L)); % TH 3 acorr_x = xcorr(x); n = -(L-1):L-1; plot(n,acorr_x); title('Do thi ham tu tuong quan'); xlabel('x'); ylabel('r_x_x');
  • 7. 6
  • 8. 7 % Bai 4.2 L = 50; % Do dai tin hieu N = 200; % So luong cac tan so roi rac trong khoang 0 den 2*pi x = rand(1,L); % Tao tin hieu ngau nhien w = linspace(0,2*pi,N); % Tao N tan so tang dan tu 0 den 2*pi fx = freqz(x,1,w); % Bien doi Fourier cua x tai cac tan so roi rac esd_x = fx.*conj(fx); % Tinh ham mat do pho nang luong acorr_x = xcorr(x); % Tinh ham tu tuong quan cua tin hieu x ft_acorr_x = freqz(acorr_x,1,w).*exp(j*w*(L-1)); % Bien doi Fourier cua ham tu tuong quan cua tin hieu x % Ve do thi subplot(2,1,1); semilogy(w/pi,esd_x); title('Do thi mat do pho nang luong'); xlabel('w');
  • 9. 8 ylabel('S(e^j^omega)') hold on; subplot(2,1,2); semilogy(w/pi,real(ft_acorr_x),'r'); title('Do thi pho ham tu tuong quan'); xlabel('w'); ylabel('R_x_x(e^j^omega)'); hold off;
  • 10. 9 Bài 5. Mã đường dây NRZ % Bai 5 len = 100000; % Do dai dong bit mo phong SNR_db = 0:2:8; % Tao vector SNR_db = 0 2 4 6 8 SNR = 10.^(SNR_db/10); % Doi SNR tu Decibel sang lan bsignal = randi([0 1],1,len); % Dong bit ngau nhien voi do dai len NRZ_signal = bsignal*2-1; % Bien doi dong bit 0 1 sang -1 1 N0 = 1./SNR; % Cong suat tap am for i=1:length(SNR_db) noise = sqrt(N0(i))*randn(1,len); % Tao tap am noise voi ti so SNR(i) r_signal = NRZ_signal + noise; % Tin hieu thu duoc = NRZ + noise NRZ_decoded = sign(r_signal); % Giai ma tin hieu NRZ thu duoc [n,BER(i)] = symerr(NRZ_decoded,NRZ_signal); % Tinh xac suat loi end plot(SNR_db,BER,'bo--'); Pe = 1/2*(1-erf(sqrt(SNR)/sqrt(2))); % Xac suat loi theo ly thuyet hold on; plot(SNR_db,Pe,'r*--'); % Ve do thi Pe title('Do thi ty le loi bit BER theo ly thuyet va mo phong'); xlabel('SNR_d_B'); ylabel('BER'); legend('Mo phong','Ly thuyet');
  • 11. 10 Bài 6. Kỹ thuật điều chế số QPSK % Bai 6 len = 50000; % Do dai dong bit mo phong SNR_db = 0; % SNR co don vi Decibel % SNR_db = 3; % Thay doi SNR = 3 dB % SNR_db = 6; % Thay doi SNR = 6 dB SNR = 10^(SNR_db/10); % Doi SNR tu Decibel sang lan bsignal = randi([0 1],1,len); % Tao dong bit ngau nhien do dai len % Bat dau thuc hien dieu che QPSK for i=1:2:len if bsignal(i)==0 & bsignal(i+1)==0 % cap bit 00 qpsk_signal((i+1)/2) = exp(j*3*pi/4); elseif bsignal(i)==0 & bsignal(i+1)==1 % cap bit 01 qpsk_signal((i+1)/2) = exp(j*5*pi/4);
  • 12. 11 elseif bsignal(i)==1 & bsignal(i+1)==1 % cap bit 11 qpsk_signal((i+1)/2) = exp(j*7*pi/4); elseif bsignal(i)==1 & bsignal(i+1)==0 % cap bit 10 qpsk_signal((i+1)/2) = exp(j*pi/4); end end Es = std(qpsk_signal)^2; % Nang luong ky hieu N0 = Es/SNR; % Cong suat tap am % Tao nhieu Gauss noise = sqrt(N0/2)*(randn(1,length(qpsk_signal))+j*randn(1,length(qpsk_signal))); qpsk_awgn = qpsk_signal + noise; % Cho tin hieu dieu che di qua kenh AWGN plot(qpsk_awgn,'.'); % Ve chom sao tin hieu co nhieu title('Do thi chom sao 4-QPSK (SNR=0dB)'); xlabel('I'); ylabel('Q'); hold on; plot(qpsk_signal,'r*'); % Ve chom sao tin hieu khong nhieu plot(exp(j*[0:0.01:2*pi]),'r--');
  • 13. 12
  • 14. 13 Bài 7. Xác suất lỗi bit trong điều chế QPSK % Bai 7 len = 50000; % Do dai dong bit mo phong SNR_db = 0:2:8; % Tao vector SNR_db = 0 2 4 6 8 SNR = 10.^(SNR_db/10); % Doi SNR tu Decibel sang lan bsignal = randi([0 1],1,len); % Tao dong bit ngau nhien do dai len % Thuc hien dieu che QPSK for i=1:2:len if bsignal(i)==0 & bsignal(i+1)==0 % cap bit 00 qpsk_signal((i+1)/2) = exp(j*3*pi/4); elseif bsignal(i)==0 & bsignal(i+1)==1 % cap bit 01 qpsk_signal((i+1)/2) = exp(j*5*pi/4); elseif bsignal(i)==1 & bsignal(i+1)==1 % cap bit 11 qpsk_signal((i+1)/2) = exp(j*7*pi/4); elseif bsignal(i)==1 & bsignal(i+1)==0 % cap bit 10 qpsk_signal((i+1)/2) = exp(j*pi/4); end end % Tim BER mo phong for i=1:length(SNR_db) r_signal = awgn(qpsk_signal,SNR_db(i)); % Dieu che QPSK di qua nhieu AWGN for j=1:2:len % Giai dieu che tin hieu QPSK co nhieu if real(r_signal((j+1)/2))>=0 if imag(r_signal((j+1)/2))>=0 % Goc phan tu I r_bsignal(j) = 1; r_bsignal(j+1) = 0; else % Goc phan tu IV r_bsignal(j) = 1; r_bsignal(j+1) = 1; end else if imag(r_signal((j+1)/2))>=0 % Goc phan tu II r_bsignal(j) = 0; r_bsignal(j+1) = 0; else % Goc phan tu III r_bsignal(j) = 0; r_bsignal(j+1) = 1; end end
  • 15. 14 end [n,BER(i)] = biterr(r_bsignal,bsignal); end Pb = 1/2*erfc(1/sqrt(2).*sqrt(SNR)); % Xac suat loi bit plot(SNR_db,Pb,'ro--'); % Ve do thi Pb ly thuyet title('Do thi ty le bit loi BER ly thuyet va mo phong'); xlabel('SNR_d_B'); ylabel('BER'); hold on; plot(SNR_db,BER); % Ve do thi BER mo phong legend('Ly thuyet','Mo phong'); hold off;
  • 16. 15 Bài 8. Mô phỏng điều chế M-QAM qua kênh nhiễu Gauss % Bai 8.1 n_sym = 50000; % So ky tu dieu che M = [16 64 256]; % So symbol ky hieu SNR_db = 0:25; % Tao vector SNR = 0 - 25 Decibel BER = zeros(length(M),length(SNR_db)); % BER de luu ti le loi bit for k = 1:size(M,2) % size(M,2) la so cot cua M s_stream = randi([0 M(k)-1],1,n_sym); % Tao dong bieu tuong do dai n_sym s_mod = qammod(s_stream,M(k),'GRAY'); % Dieu che M-QAM for r = 1:size(SNR_db,2) % Vong lap tinh BER s_mod_awgn = awgn(s_mod,SNR_db(r),'measured'); % Tin hieu qua nhieu s_demod = qamdemod(s_mod_awgn,M(k),'GRAY'); % Giai dieu che M-QAM [num, ratio] = biterr(s_stream,s_demod); % Tinh ti le loi bit BER(k,r) = ratio; % Luu ti le loi bit vao BER end end semilogy(SNR_db,BER(1,:),'gx', 'LineStyle', 'none'); % Ve do thi BER voi M = 16 hold on; semilogy(SNR_db,BER(2,:),'ro', 'LineStyle', 'none'); % Ve do thi BER voi M = 64 semilogy(SNR_db,BER(3,:),'b*', 'LineStyle', 'none'); % Ve do thi BER voi M = 256 grid on; BER_lt = zeros(length(M),length(SNR_db)); for i = 1:length(M) BER_lt(i,:) = berawgn(SNR_db - 10*log10(log2(M(i))),'qam',M(i)); end semilogy(SNR_db,BER_lt(1,:),'g-'); % Ve do thi BER ly thuyet voi M = 16 semilogy(SNR_db,BER_lt(2,:),'r-'); % Ve do thi BER ly thuyet voi M = 64 semilogy(SNR_db,BER_lt(3,:),'b-'); % Ve do thi BER ly thuyet voi M = 256 title('Do thi ty le loi bit mo phong va ly thuyet cua ky thuat M-QAM'); xlabel('SNR_d_B');
  • 17. 16 ylabel('BER/Pe'); legend('BER 16-QAM','BER 64-QAM','BER 256-QAM','Pe 16-QAM','Pe 64-QAM','Pe 256-QAM', 'Location', 'southwest'); hold off;