Báo cáo thí nghiệm thông tin số đại học Bách Khoa Hà Nội - Pdf 35

Báo cáo thí nghiệm thông tin số
Họ và tên:
Lớp:
I.

MSSV:
Bài 1:Quá trình ngẫu nhiên của tín hiệu

Bài 1.1:
Source code:
x=-5:0.1:5;
Px=(1/sqrt(2*pi)*exp(-x.^2/2));
plot(x,Px);
% Ve do thi
xlabel('x');
% Label cho truc hoanh
ylabel('Px'); % Label cho truc tung
title(' Do thi ham phan bo xac suat Gauss'); % Ten do thi
Kết quả mô phỏng:


Bài 1.2:
Source code:
length=100000;
% Do dai cua qua trinh ngau nhien
x=randn(1,length); % Tao qua trinh ngau nhien theo phan
phoi chuan
step=.1;
% buoc nhay bang 0.1
k=-5:step:5;
% Khoang xet tu -5 den 5, b?oc nhay

q=(xmax-xmin)/nlevel; % Buoc luong tu
[indx qy]=quantiz(x,xmin+q:q:xmax-q,xmin+q/2:q:xmax-q/2);
Lệnh Command:


>> xs=rand(1,5)*2-1;
>> [xi xq]=lquan(xs,-1,1,3)
xi =
1

3

1

7

0

xq =
-0.6250 -0.1250 -0.6250 0.8750 -0.8750
Bài 2.2:
Source code:
t = 0:.01:20;
xt = sin( randn() + t).*cos(rand()*t);
% Tin hieu vao
[inx xqt] = lquan (xt, -1, 1, randi(3)+1);
% xqt: tin hieu da duoc luong tu hoa
plot(t,xt,'b',t,xqt,'r');
% Ve 2 do thi tren cung 1 he truc
grid on ;

Ps_uni = sum (x_uni.^2)/N;
% Cong suat tinh hieu mo phong
Ps_sin = sum (x_sin.^2)/N;
% Cong suat tin hieu sin
for i=1:size(nbit,2)
[xi xq_uni] = lquan (x_uni,-1,1,nbit(i) );
% Luong tu hoa voi ket qua dua vao xq
eq_uni = x_uni - xq_uni;
sai so

% Tinh


Pq_uni= sum (eq_uni.^2)/N;
% Cong
suat tap am luong tu
SNqR_uni(i) = 10 .* log10 (Ps_uni ./Pq_uni) ;
% tinh
SNqR
end
for i=1:size(nbit,2)
% tra ve so cot n
[xi xq_sin] = lquan (x_sin,-1,1,nbit(i) );
% Luong tu hoa voi ket qua dua vao xq
eq_sin = x_sin - xq_sin;
% Sai so eq_sin
Pq_sin= sum (eq_sin.^2)/N;
% Cong suat tap am luong tu Pq_sin
SNqR_sin(i) = 10 .* log10 (Ps_sin ./Pq_sin) ;
% tinh SNqR_sin

subplot(2,2,2) % 2 hang, 2 cot, o thu 2
stem(y1,n);
title('Do thi ham tu tuong quan cua x1=linspace(-1,1,L)');
xlabel('n');
[n y2]=xcorr(x2);
subplot(2,2,3) % 2 hang, 2 cot, o thu 3
stem(y2,n);
title('Do thi ham tu tuong quan cua x2=sin(linspace(10,10,L))');
xlabel('n');
Kết quả mô phỏng:



Bài 4.2:
Source code:
N=200;
x=randn(1,50);
w=linspace(0,2*pi,N);
fx=freqz(x,1,w);
esd_x=fx.*conj(fx);
acorr_x=xcorr(x);
ft_acorr_x=freqz(acorr_x,1,w).*exp(j*w*49);
subplot(2,1,1);
semilogy(w/pi,esd_x);
title('Ham mat do nang luong cua tin hieu');
xlabel('w/pi');
ylabel('esd_x');
subplot(2,1,2);
semilogy(w/pi,real(ft_acorr_x),'b');
title('Pho cua ham tu tuong quan');

Bài 5.2:
Source code:
len=100000;
SNR_db=0:2:8;
for i=1:length(SNR_db)
SNR=10.^(SNR_db/10);
N0=1./SNR;
NRZ_signal=randsrc(1,len);
noise=sqrt(N0(i)).*randn(size(NRZ_signal));
r_signal=NRZ_signal+noise;
NRZ_decoded=sign(r_signal);
[Num,BER(i)]=symerr(NRZ_signal,NRZ_decoded);
Pe=0.5*(1-erf(sqrt(SNR/2)));
end
semilogy(SNR_db,BER,'bo--',SNR_db,Pe,'r*--');%Ve 2 do thi
tren cung he truc
xlabel('SNR(dB)');
% Ten truc hoanh


legend('ly thuyet','Thuc te'); % Tao chu thich
title('Ti le loi bit');
% Ten do thi

Kết quả mô phỏng:

VI.

Bài 6:Kỹ thuật điều chế số QPSK:


qpsk_awgn=qpsk_signal + noise; % Tin hieu khi co nhieu
plot(qpsk_awgn,'o');
title('SNR=0dB');
grid on;
axis auto;
xlabel('I');
ylabel('Q');
hold on;
plot(qpsk_signal,'o');
t=0:0.01:2*pi;
plot(exp(j*t),'k--');
xlabel('I');
ylabel('Q');
title('Bieu do chom sao cua tin hieu dieu che QPSK va tin
hieu sau khi di qua kenh AWGN');

Kết quả mô phỏng:
a. SNR=0dB:


b. SNR=3dB:

c. SNR=6dB:


VII.

Bài 7:Xác xuất lỗi bit trong điều chế QPSK:

Source code:

else
r_bsignal(t) = 1;
r_bsignal(t+1) = 1;
end
else
if imag(r_signal((t+1)/2))>=0
r_bsignal(t) = 0;
r_bsignal(t+1) = 0;
else
r_bsignal(t) = 0;
r_bsignal(t+1) = 1;
end
end
end
[number,ratio] = biterr(bsignal,r_bsignal);
BER(k) = ratio
end
Pb = 1/2.*erfc(sqrt(SNR/2))
plot(SNR_bd,Pb,'o-',SNR_bd,BER,'r');
title('Ty le loi bit ly thuyet va mo phong');
xlabel('SNR_bd');
ylabel('Pb');
legend('Ly thuyet','Mo phong');
Kết quả mô phỏng


VIII. Bài 8:Mô phỏng điều chế M- QAM qua kênh nhiễu Gauss
Source code:
n_sym = 50000; % So ki tu dieu che
M = [16 32 64];


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status