BÁO CÁO THÍ NGHIỆM THÔNG TIN SỐ
Sinh viên thực hiện : Bùi Văn Tài
Lớp : ĐTVT 05-K56
Mã sinh viên : 20112102
Bài 1 : Quá trình ngẫu nhiên của tín hiệu
Bài 1.1
Code :
x = -5:0.1:5;
px = (1/sqrt(2*pi))*exp(-x.^2/2);
plot(x,px);
Figure
Bài 1.2
Code :
len = 100000;
x = randn(1,len);
step = .1;
k = -5:step:5;
px = hist(x,k)/len/step;
stem(k,px);
Px_lythuyet = exp(-k.^2/2)/sqrt(2*pi);
hold on;
plot(k,Px_lythuyet);
title(' Phan bo xac suat Gauss ');
xlabel('x');
ylabel('P(x)');
legend(' Ly thuyet',' Mo phong ');
hold off;
Figure
Bài 2 : Lượng tử hóa tuyến tính
Bài 2.2
Code :
Hàm lquan :
function [indx qy] = lquan(x,xmin,xmax,nbit)
nlevel = 2^nbit;
q = (xmax-xmin)/nlevel;
[indx qy] = quantiz(x,xmin+q:q:xmax-q,xmin+q/2:q:xmax-q/2);
Hàm chính :
t = 0:.01:20;
xt = sin(randn()+t).*cos(rand()*t);
[inx xqt] = lquan(xt,-1,1,randint(1,1,3)+2);
plot(t,xt,'b',t,xqt,'r');
grid on;
title(' Luong tu hoa tuyen tinh ');
xlabel ('t');
ylabel ('y');
legend('xt','xqt');
Figure :
Bài 3 : Tạp âm lượng tử trong kĩ thuật lượng tử hóa tuyến tính
Bài 3.1
Code :
rand(1,len)
N = 1000;
x = 2*rand(1,N)-1; %x phan bo deu tu -1 den 1
nbit = 1:10; %denso bit luong tu tu 1 den 10
SNqR = zeros(size(nbit)); % khoi tao mang SNqR chua ket qua
SNqR_lt = 6.02*nbit; % khoi tao mang SNqR tinh theo ly thuyet
Ps = sum(x.^2)/N; % cong suat tin hieu x theo (3-3)
for i=1:size(nbit,2) % size(n,2)tra ve so cot cua n
[inx xq] = lquan(x,-1,1,nbit(i)); % luong tu hoa x voi so bit nbit i luu vao xq
eq(i) = x(i)-xq(i); % tính sai so eq
Pq = (eq(i))/N; % tinh cong suat tap am luong tu Pq theo 3-4
SNqR(i) = 10*log10(Ps/Pq); % Tính SNqR(i)
end;
plot(nbit,SNqR,'b',nbit,SNqR_lt,'r'); % Ve do thi ket qua SNqR_db theo nbit
title(' Do thi ket qua theo SNqR_db theo nbit ');
xlabel ('nbit');
ylabel ('SNqR[dB]');
legend('Mo phong','Ly thuyet');
Figure :
Bài 3.2
Code :
rand(1,len)
N = 1000;
x = sin(linspace(1,5,N)); %x phan bo deu tu -1 den 1
nbit = 1:10; %denso bit luong tu tu 1 den 10
SNqR = zeros(size(nbit)); % khoi tao mang SNqR chua ket qua
SNqR_lt = 6.02*nbit; % khoi tao mang SNqR tinh theo ly thuyet
Ps = sum(x.^2)/N; % cong suat tin hieu x theo (3-3)
for i=1:size(nbit,2) % size(n,2)tra ve so cot cua n
[inx xq] = lquan(x,-1,1,nbit(i)); % luong tu hoa x voi so bit nbit i luu vao xq
eq(i) = x(i)-xq(i); % tính sai so eq
Pq = (eq(i))/N; % tinh cong suat tap am luong tu Pq theo 3-4
SNqR(i) = 10*log10(Ps/Pq); % Tính SNqR(i)
end;
plot(nbit,SNqR,'b',nbit,SNqR_lt,'r'); % Ve do thi ket qua SNqR_db theo nbit
title(' Do thi ket qua theo SNqR_db theo nbit ');
xlabel ('nbit');
ylabel ('SNqR[dB]');
legend('Mo phong','Ly thuyet');