This document contains the MATLAB code and simulation results for experiments on digital communication techniques. It includes simulations of:
1) Gaussian noise modeling.
2) Linear quantization technique.
3) Quantization noise in linear quantization.
4) Energy spectral density and autocorrelation function of signals.
5) NRZ line coding technique.
6) QPSK digital modulation technique.
7) Bit error probability in QPSK modulation.
8) Simulation of M-QAM modulation over Gaussian channels.
The simulations generate signals, add noise, and analyze/plot the bit error rate, power spectral density, constellation diagrams, and other metrics. The results are compared to theoretical predictions.
EXPERT SYSTEMS AND SOLUTIONS
Project Center For Research in Power Electronics and Power Systems
IEEE 2010 , IEEE 2011 BASED PROJECTS FOR FINAL YEAR STUDENTS OF B.E
Email: expertsyssol@gmail.com,
Cell: +919952749533, +918608603634
www.researchprojects.info
OMR, CHENNAI
IEEE based Projects For
Final year students of B.E in
EEE, ECE, EIE,CSE
M.E (Power Systems)
M.E (Applied Electronics)
M.E (Power Electronics)
Ph.D Electrical and Electronics.
Training
Students can assemble their hardware in our Research labs. Experts will be guiding the projects.
EXPERT GUIDANCE IN POWER SYSTEMS POWER ELECTRONICS
We provide guidance and codes for the for the following power systems areas.
1. Deregulated Systems,
2. Wind power Generation and Grid connection
3. Unit commitment
4. Economic Dispatch using AI methods
5. Voltage stability
6. FLC Control
7. Transformer Fault Identifications
8. SCADA - Power system Automation
we provide guidance and codes for the for the following power Electronics areas.
1. Three phase inverter and converters
2. Buck Boost Converter
3. Matrix Converter
4. Inverter and converter topologies
5. Fuzzy based control of Electric Drives.
6. Optimal design of Electrical Machines
7. BLDC and SR motor Drives
Applied Digital Signal Processing 1st Edition Manolakis Solutions Manualtowojixi
Full download http://alibabadownload.com/product/applied-digital-signal-processing-1st-edition-manolakis-solutions-manual/
Applied Digital Signal Processing 1st Edition Manolakis Solutions Manual
EXPERT SYSTEMS AND SOLUTIONS
Project Center For Research in Power Electronics and Power Systems
IEEE 2010 , IEEE 2011 BASED PROJECTS FOR FINAL YEAR STUDENTS OF B.E
Email: expertsyssol@gmail.com,
Cell: +919952749533, +918608603634
www.researchprojects.info
OMR, CHENNAI
IEEE based Projects For
Final year students of B.E in
EEE, ECE, EIE,CSE
M.E (Power Systems)
M.E (Applied Electronics)
M.E (Power Electronics)
Ph.D Electrical and Electronics.
Training
Students can assemble their hardware in our Research labs. Experts will be guiding the projects.
EXPERT GUIDANCE IN POWER SYSTEMS POWER ELECTRONICS
We provide guidance and codes for the for the following power systems areas.
1. Deregulated Systems,
2. Wind power Generation and Grid connection
3. Unit commitment
4. Economic Dispatch using AI methods
5. Voltage stability
6. FLC Control
7. Transformer Fault Identifications
8. SCADA - Power system Automation
we provide guidance and codes for the for the following power Electronics areas.
1. Three phase inverter and converters
2. Buck Boost Converter
3. Matrix Converter
4. Inverter and converter topologies
5. Fuzzy based control of Electric Drives.
6. Optimal design of Electrical Machines
7. BLDC and SR motor Drives
Applied Digital Signal Processing 1st Edition Manolakis Solutions Manualtowojixi
Full download http://alibabadownload.com/product/applied-digital-signal-processing-1st-edition-manolakis-solutions-manual/
Applied Digital Signal Processing 1st Edition Manolakis Solutions Manual
Please use the same variables and only write the TODO part #!-usr-bi.pdfasenterprisestyagi
Please use the same variables and only write the TODO part
#!/usr/bin/env octave
% Only modify this file where you see a "% TODO"
% Functions that do not contain this should not be modified.
% If you modify them for debugging, please remove/comment those modifications.
% This line tells octave that this is not a function file.
1;
% Workaround fltk bug. You might need to comment this line out .
graphics_toolkit("gnuplot");
% Meanings of commonly encountered variables:
% n = number of particles
% x = 2*n dimensional column vector with the positions of the particles
% v = 2*n dimensional column vector with the velocities of the particles
% Note that the ordering is always x1 y1 x2 y2 x3 y3 ...
% ks = spring constant
% kc = penalty collision strength
% l0 = matrix of spring rest lengths.
% l0(i,j) = initial length of spring between particles i and j (i<j)
% Note that l0(i,j) should not be used if i>=j.
% S = matrix indicating which springs exist
% S(i,j) = 1 if there is a spring between particles i and j (i<j)
% Note that S(i,j) should not be used if i>=j.
% m = mass of the particles (all particles have the same mass)
% Computes the total potential energy for the system.
function E = Potential_Energy(x,ks,kc,l0,S)
n = rows(S);
E = 0;
% For each pair of particles (i<j)
for i = 1:n
xi = x(2*i-1:2*i,1); % Position of particle i
for j = i+1:n
% If there is a spring between particles i and j
if S(i,j)>0
xj = x(2*j-1:2*j,1); % Position of particle j
% Compute the potential energy of the spring.
E = E + .5*ks/l0(i,j)*(norm(xi-xj)-l0(i,j))^2;
end
end
% Compute the potential energy of the penalty collision force for particle i
% If the particle is inside the radius 2 circle centered at the origin,
% then there is no collision (no force, zero potential energy).
% Otherwise, the energy rises quadratically with distance from the circle.
E = E + .5*kc*max(norm(xi)-2,0)^2;
end
end
% Computes the total energy for the system.
function E = Total_Energy(x,v,m,ks,kc,l0,S)
n = rows(S);
KE = 0;
% Kinetic energy for particle = 1/2 m ||v||^2
for i = 1:n
vi = v(2*i-1:2*i,1);
KE = KE + .5*m*(vi'*vi);
end
% Total energy is kinetic + potential
E = KE + Potential_Energy(x,ks,kc,l0,S);
end
% Computes the total force for all of the particles in the system. x is a 2*n
% dimensional vector. On exit, F should be a 2*n dimensional vector containing
% the total force on each of the n particles. The force can be deduced from the
% potential energy. In particular, F(k) is the negative partial derivative of PE
% with respect to x(k). Here k=1..2*n and PE is the quantity computed by
% Potential_Energy. Treat the Potential_Energy function as a regular math
% function, which is a function of its input x.
function F = Force(x,ks,kc,l0,S)
n = rows(S);
F = zeros(2*n,1);
% TODO
end
% Computes the total momentum p and angular momentum L for the system
function [p L] = Momentum(x,v,m)
n = rows(x)/2;
p = zeros(2,1); % 2D vector; total momentum
L = 0; % Scalar; total angular momentum
for i = 1:.
Use the same variable names and write the function F - Force(x-ks-kc-l.pdfacteleshoppe
Use the same variable names and write the function F = Force(x,ks,kc,l0,S) ; function l0 =
Compute_Rest_Length(x) ; function z = Equations_Of_Motion(xv,m,ks,kc,l0,S) ; in octave. And
answer the 6 questions below
#!/usr/bin/env octave
% Only modify this file where you see a "% TODO"
% Functions that do not contain this should not be modified.
% If you modify them for debugging, please remove/comment those modifications.
% This line tells octave that this is not a function file.
1;
% Workaround fltk bug. You might need to comment this line out.
graphics_toolkit("gnuplot");
% Meanings of commonly encountered variables:
% n = number of particles
% x = 2*n dimensional column vector with the positions of the particles
% v = 2*n dimensional column vector with the velocities of the particles
% Note that the ordering is always x1 y1 x2 y2 x3 y3 ...
% ks = spring constant
% kc = penalty collision strength
% l0 = matrix of spring rest lengths.
% l0(i,j) = initial length of spring between particles i and j (i<j)
% Note that l0(i,j) should not be used if i>=j.
% S = matrix indicating which springs exist
% S(i,j) = 1 if there is a spring between particles i and j (i<j)
% Note that S(i,j) should not be used if i>=j.
% m = mass of the particles (all particles have the same mass)
% Computes the total potential energy for the system.
function E = Potential_Energy(x,ks,kc,l0,S)
n = rows(S);
E = 0;
% For each pair of particles (i<j)
for i = 1:n
xi = x(2*i-1:2*i,1); % Position of particle i
for j = i+1:n
% If there is a spring between particles i and j
if S(i,j)>0
xj = x(2*j-1:2*j,1); % Position of particle j
% Compute the potential energy of the spring.
E = E + .5*ks/l0(i,j)*(norm(xi-xj)-l0(i,j))^2;
end
end
% Compute the potential energy of the penalty collision force for particle i
% If the particle is inside the radius 2 circle centered at the origin,
% then there is no collision (no force, zero potential energy).
% Otherwise, the energy rises quadratically with distance from the circle.
E = E + .5*kc*max(norm(xi)-2,0)^2;
end
end
% Computes the total energy for the system.
function E = Total_Energy(x,v,m,ks,kc,l0,S)
n = rows(S);
KE = 0;
% Kinetic energy for particle = 1/2 m ||v||^2
for i = 1:n
vi = v(2*i-1:2*i,1);
KE = KE + .5*m*(vi'*vi);
end
% Total energy is kinetic + potential
E = KE + Potential_Energy(x,ks,kc,l0,S);
end
% Computes the total force for all of the particles in the system. x is a 2*n
% dimensional vector. On exit, F should be a 2*n dimensional vector containing
% the total force on each of the n particles. The force can be deduced from the
% potential energy. In particular, F(k) is the negative partial derivative of PE
% with respect to x(k). Here k=1..2*n and PE is the quantity computed by
% Potential_Energy. Treat the Potential_Energy function as a regular math
% function, which is a function of its input x.
function F = Force(x,ks,kc,l0,S)
n = rows(S);
F = zeros(2*n,1);
% TODO
end
% Computes the total momentum p and angular momentum L for t.
MATLAB is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages
Please use the same variables and only write the TODO part #!-usr-bi.pdfasenterprisestyagi
Please use the same variables and only write the TODO part
#!/usr/bin/env octave
% Only modify this file where you see a "% TODO"
% Functions that do not contain this should not be modified.
% If you modify them for debugging, please remove/comment those modifications.
% This line tells octave that this is not a function file.
1;
% Workaround fltk bug. You might need to comment this line out .
graphics_toolkit("gnuplot");
% Meanings of commonly encountered variables:
% n = number of particles
% x = 2*n dimensional column vector with the positions of the particles
% v = 2*n dimensional column vector with the velocities of the particles
% Note that the ordering is always x1 y1 x2 y2 x3 y3 ...
% ks = spring constant
% kc = penalty collision strength
% l0 = matrix of spring rest lengths.
% l0(i,j) = initial length of spring between particles i and j (i<j)
% Note that l0(i,j) should not be used if i>=j.
% S = matrix indicating which springs exist
% S(i,j) = 1 if there is a spring between particles i and j (i<j)
% Note that S(i,j) should not be used if i>=j.
% m = mass of the particles (all particles have the same mass)
% Computes the total potential energy for the system.
function E = Potential_Energy(x,ks,kc,l0,S)
n = rows(S);
E = 0;
% For each pair of particles (i<j)
for i = 1:n
xi = x(2*i-1:2*i,1); % Position of particle i
for j = i+1:n
% If there is a spring between particles i and j
if S(i,j)>0
xj = x(2*j-1:2*j,1); % Position of particle j
% Compute the potential energy of the spring.
E = E + .5*ks/l0(i,j)*(norm(xi-xj)-l0(i,j))^2;
end
end
% Compute the potential energy of the penalty collision force for particle i
% If the particle is inside the radius 2 circle centered at the origin,
% then there is no collision (no force, zero potential energy).
% Otherwise, the energy rises quadratically with distance from the circle.
E = E + .5*kc*max(norm(xi)-2,0)^2;
end
end
% Computes the total energy for the system.
function E = Total_Energy(x,v,m,ks,kc,l0,S)
n = rows(S);
KE = 0;
% Kinetic energy for particle = 1/2 m ||v||^2
for i = 1:n
vi = v(2*i-1:2*i,1);
KE = KE + .5*m*(vi'*vi);
end
% Total energy is kinetic + potential
E = KE + Potential_Energy(x,ks,kc,l0,S);
end
% Computes the total force for all of the particles in the system. x is a 2*n
% dimensional vector. On exit, F should be a 2*n dimensional vector containing
% the total force on each of the n particles. The force can be deduced from the
% potential energy. In particular, F(k) is the negative partial derivative of PE
% with respect to x(k). Here k=1..2*n and PE is the quantity computed by
% Potential_Energy. Treat the Potential_Energy function as a regular math
% function, which is a function of its input x.
function F = Force(x,ks,kc,l0,S)
n = rows(S);
F = zeros(2*n,1);
% TODO
end
% Computes the total momentum p and angular momentum L for the system
function [p L] = Momentum(x,v,m)
n = rows(x)/2;
p = zeros(2,1); % 2D vector; total momentum
L = 0; % Scalar; total angular momentum
for i = 1:.
Use the same variable names and write the function F - Force(x-ks-kc-l.pdfacteleshoppe
Use the same variable names and write the function F = Force(x,ks,kc,l0,S) ; function l0 =
Compute_Rest_Length(x) ; function z = Equations_Of_Motion(xv,m,ks,kc,l0,S) ; in octave. And
answer the 6 questions below
#!/usr/bin/env octave
% Only modify this file where you see a "% TODO"
% Functions that do not contain this should not be modified.
% If you modify them for debugging, please remove/comment those modifications.
% This line tells octave that this is not a function file.
1;
% Workaround fltk bug. You might need to comment this line out.
graphics_toolkit("gnuplot");
% Meanings of commonly encountered variables:
% n = number of particles
% x = 2*n dimensional column vector with the positions of the particles
% v = 2*n dimensional column vector with the velocities of the particles
% Note that the ordering is always x1 y1 x2 y2 x3 y3 ...
% ks = spring constant
% kc = penalty collision strength
% l0 = matrix of spring rest lengths.
% l0(i,j) = initial length of spring between particles i and j (i<j)
% Note that l0(i,j) should not be used if i>=j.
% S = matrix indicating which springs exist
% S(i,j) = 1 if there is a spring between particles i and j (i<j)
% Note that S(i,j) should not be used if i>=j.
% m = mass of the particles (all particles have the same mass)
% Computes the total potential energy for the system.
function E = Potential_Energy(x,ks,kc,l0,S)
n = rows(S);
E = 0;
% For each pair of particles (i<j)
for i = 1:n
xi = x(2*i-1:2*i,1); % Position of particle i
for j = i+1:n
% If there is a spring between particles i and j
if S(i,j)>0
xj = x(2*j-1:2*j,1); % Position of particle j
% Compute the potential energy of the spring.
E = E + .5*ks/l0(i,j)*(norm(xi-xj)-l0(i,j))^2;
end
end
% Compute the potential energy of the penalty collision force for particle i
% If the particle is inside the radius 2 circle centered at the origin,
% then there is no collision (no force, zero potential energy).
% Otherwise, the energy rises quadratically with distance from the circle.
E = E + .5*kc*max(norm(xi)-2,0)^2;
end
end
% Computes the total energy for the system.
function E = Total_Energy(x,v,m,ks,kc,l0,S)
n = rows(S);
KE = 0;
% Kinetic energy for particle = 1/2 m ||v||^2
for i = 1:n
vi = v(2*i-1:2*i,1);
KE = KE + .5*m*(vi'*vi);
end
% Total energy is kinetic + potential
E = KE + Potential_Energy(x,ks,kc,l0,S);
end
% Computes the total force for all of the particles in the system. x is a 2*n
% dimensional vector. On exit, F should be a 2*n dimensional vector containing
% the total force on each of the n particles. The force can be deduced from the
% potential energy. In particular, F(k) is the negative partial derivative of PE
% with respect to x(k). Here k=1..2*n and PE is the quantity computed by
% Potential_Energy. Treat the Potential_Energy function as a regular math
% function, which is a function of its input x.
function F = Force(x,ks,kc,l0,S)
n = rows(S);
F = zeros(2*n,1);
% TODO
end
% Computes the total momentum p and angular momentum L for t.
MATLAB is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages
A MODIFIED DIRECTIONAL WEIGHTED CASCADED-MASK MEDIAN FILTER FOR REMOVAL OF RA...cscpconf
In this paper a Modified Directional Weighted Cascaded-Mask Median (MDWCMM) filter has
been proposed, which is based on three different sized cascaded filtering windows. The
differences between the current pixel and its neighbors aligned with four main directions. A
direction index is used for each edge aligned with a given direction. Then, the minimum of these
four direction indexes is used for impulse detection for each and every masking window.
Depending on the minimum direction indexes among the three windows one window is selected.
The filtering is done on this selected window. Extensive simulations showed that the MDWCMM
filter provides good performances of suppressing impulse with low noise level as well as for highly corrupted images from both gray level and colored benchmarked images.
Leading the Way in Nephrology: Dr. David Greene's Work with Stem Cells for Ki...Dr. David Greene Arizona
As we watch Dr. Greene's continued efforts and research in Arizona, it's clear that stem cell therapy holds a promising key to unlocking new doors in the treatment of kidney disease. With each study and trial, we step closer to a world where kidney disease is no longer a life sentence but a treatable condition, thanks to pioneers like Dr. David Greene.
QA Paediatric dentistry department, Hospital Melaka 2020Azreen Aj
QA study - To improve the 6th monthly recall rate post-comprehensive dental treatment under general anaesthesia in paediatric dentistry department, Hospital Melaka
R3 Stem Cells and Kidney Repair A New Horizon in Nephrology.pptxR3 Stem Cell
R3 Stem Cells and Kidney Repair: A New Horizon in Nephrology" explores groundbreaking advancements in the use of R3 stem cells for kidney disease treatment. This insightful piece delves into the potential of these cells to regenerate damaged kidney tissue, offering new hope for patients and reshaping the future of nephrology.
Navigating the Health Insurance Market_ Understanding Trends and Options.pdfEnterprise Wired
From navigating policy options to staying informed about industry trends, this comprehensive guide explores everything you need to know about the health insurance market.
Welcome to Secret Tantric, London’s finest VIP Massage agency. Since we first opened our doors, we have provided the ultimate erotic massage experience to innumerable clients, each one searching for the very best sensual massage in London. We come by this reputation honestly with a dynamic team of the city’s most beautiful masseuses.
Navigating Challenges: Mental Health, Legislation, and the Prison System in B...Guillermo Rivera
This conference will delve into the intricate intersections between mental health, legal frameworks, and the prison system in Bolivia. It aims to provide a comprehensive overview of the current challenges faced by mental health professionals working within the legislative and correctional landscapes. Topics of discussion will include the prevalence and impact of mental health issues among the incarcerated population, the effectiveness of existing mental health policies and legislation, and potential reforms to enhance the mental health support system within prisons.
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');
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');
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--');
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');