You are on page 1of 6

BO CO TH NGHIM THNG TIN S

H v tn :
Lp : T 10-K52

Mssv:
Bi s 1

1.1 V hm phn b xc sut Gauss


x=-3:0.02:3;
p=1/sqrt(2*pi)*exp(-x.^2/2);
plot(x,p);
title('ham phan bo xac suat cua bien ngau nhien');
xlabel('x');
ylabel('y');
ham phan bo xac suat cua bien ngau nhien
0.4

0.35

0.3

0.25

0.2

0.15

0.1

0.05

0
-3

-2

-1

0
x

1.2 To mt qu trnh ngu nhin vi tr trung bnh v lch chun nh


trng hp trn:
m=0;
sigma=1;

n=100000;
x=-4:0.05:4;
p=(1/sqrt(2*pi)*sigma)*exp(-(x-m).^2/2*sigma^2);
check=trapz(x,p);
plot(x,p,'r');
hold on;
y=randn(1,n);
m=mean(y);
vairiance=std(y)^2;
x2=-4:0.1:4;
c=hist(y,x2);
stem(x2,c/n/(x2(2)-x2(1)));
title('ham mat do phan bo');
xlabel('X');
ylabel('Y');
hold off;
ham mat do phan bo
0.45
0.4
0.35
0.3

0.25
0.2
0.15
0.1
0.05
0
-4

-3

-2

-1

0
X

So vi th thu c 1.1, ng bao ca 2 th l nh


nhau, cho thy phn b xc sut ca qu trnh ngu nhin tun
theo phn b xc sut Gauss.

Bi s 3
3.1 Biu chm sao ca tn hiu iu ch QPSK m ha theo m
Gray :

clear;

x=round(rand(1,10000));
plot(x);
for i=1:2:length(x)
if x(i)==0&x(i+1)==0
s((i+1)/2)=exp(j*pi/4);
elseif x(i)==0&x(i+1)==1
s((i+1)/2)=exp(j*3*pi/4);
elseif x(i)==1&x(i+1)==1
s((i+1)/2)=exp(j*5*pi/4);
elseif x(i)==1&x(i+1)==0
s((i+1)/2)=exp(j*7*pi/4);
end
end
save ex3p1_res s x;
plot(s,'*');
hold on;
t=0:0.01:2*pi;
plot(exp(j*t),'r--');
xlabel('\phi(t)');
ylabel('S_m');
title('bieu do khong gian tin hieu phuc cua tin hieu dieu
che QPSK');
bieu do khong gian tin hieu phuc cua tin hieu dieu che QPSK
1
0.8
0.6
0.4

0.2
0
-0.2
-0.4
-0.6
-0.8
-1
-1

-0.8

-0.6

-0.4

-0.2

0
(t)

0.2

0.4

0.6

0.8

3.2 Cho tn hiu trn qua knh nhiu trng AWGN :

clear;
load ex3p1_res;
es=var(s);
eb=es/2;
snr_db=6;
n_0=eb/10^(snr_db/10);
n=sqrt(n_0/2)*(randn(size(s))+j*randn(size(s)));
r=s+n;
plot(r,'.');
hold on;
plot(s,'r*');
hold on;
t=0:0.01:2*pi;
plot(exp(j*t),'r--');
legend('S_m','S');
xlabel('I');
ylabel('Q');
title('Bieu do khong gian tin hieu phuc');
Bieu do khong gian tin hieu phuc
1.5
S

0.5

-0.5

-1

-1.5

-2
-2

-1.5

-1

-0.5

0
I

0.5

1.5

Bi s 4
4.1 M phng h thng truyn dn s bng tn c s QPSK :
Xy dng hm:
clear all;
load ex3p1_res s x;
snr_db=0:2:8;
for i=1:length(snr_db)
c(i)=cha(snr_db(i),s,x);
end
BEP=c/length(x);
semilogy(snr_db,BEP,'--');
title('The bit error probability');
xlabel('SNR in dB');
ylabel('P_b');
legend('P_b');
save ex4p1_res c BEP;
The bit error probability

-1

10

-2

Pb

10

-3

10

-4

10

4
SNR in dB

4.2 Tnh t l li bit l thuyt


clear;
snr_db=0:8;
snr_db_simulation=0:2:8;
for i=1:length(snr_db)

snr(i)=10^(snr_db(i)/10);
gamma_b(i)=snr(i);
p_b(i)=erfc(sqrt(2*gamma_b(i))/sqrt(2))/2;

end
semilogy(snr_db,p_b,'ro--')
hold on
load ex6p1_res c BEP;
semilogy(snr_db_simulation,BEP,'x--')
title('The bit error probability');
xlabel('SNR in dB');
ylabel('P_b');
legend('Theory','Simulation');
hold off
The bit error probability

-1

10

Theory
Simulation

-2

10

-3

10

-4

10

4
SNR in dB

You might also like