Вы находитесь на странице: 1из 15

PROJECT TITLE 9

COURSE CODE

: EECB353

COURSE NAME

: COMMUNICATION SYSTEM

NAME

: MUHAMAD AZRUL BIN MOHAMAD

EE093769

: MOHAMAD FIRDAUS BIN HASSAN

EE093172

: AMIRA AQILAH BINTI MOHAMMAD AROFF

EE092995

: MOHD KHAIRI BIN ABDUL KAHAR

EE093847

SECTION

:2

LECTURERS NAME

: DR. NORAZIZAH BINTI MOHD ARIPIN

DATE OF SUBMISSION : 13TH SEPTEMBER 2016

PART A: PULSE CODE MODULATION


A. BLOCK DIAGRAM OF THE PCM
PCM transmitter
Analo
g

Inpu
t
sign

Parallel

PAM
Bandpass
Filter

Analog to
Digital
Converter

Sample and
Hold

Sample
pulse

Conversion

Parallel to
Serial
Converter

Line speed

Serial PCM
code
Serial PCM
Commu
code
nication
channel

Serial PCM
code
Regenerativ
e repeater

Regenerativ
e repeater

Analo
g

PAM

Parallel
data
Serial to
parallel
converter

Digital to
Analog
converter

Line speed

Conversion

Hold circuit

PCM receiver
B. CALCULATION AND ASSUMPTION VALUES

Low pass
filter

Outp
ut
Signa

Bandwidth, B allocated = 48kHz


Input narrowband signals frequency, famax = 3kHz
Sampling frequency, fs = 8kHz

10V

Voltage range =

Quantization Error, Qe
*1% quantization distortion from the peak-to-peak analog signal voltage, Vpp.
Qe = 0.01 x 20V = 0.2V

v , required

Step size,

v
=0.2 V
2

Qe =

v = 0.4V
Quantization Level

0.4

20
Level

20
Level

(actual)

6 (actual)

v , actual

v , actual=

26=64 levels

n = 5.64 (required)

Level = 50 levels
Step size,

2n=50 levels

20
64

= 0.3125V

Dynamic Range (DR)


For n>4,
DR=6n
=36dB

Signal to Quantization Noise Ratio (SQR)

Bandwidth, B required
*Assuming the system is noiseless

SQRdB = 6.02n+1.76

Bandwidth, B = 2nfa

=6.02(6) +1.76

n=6, fa=3kHz

=37.88dB

B = 2(6) (3kHz)
=36kHz < 48kHz
The required bandwidth is less than the value of
the allocated bandwidth.

Bit rate
*Assuming the system is noiseless

C=2log2(M)
C=2log2(2^6)
C=2log2(64)
C=12kbps

C. PCM CODEBOOK AND VOLTAGE LEVELS

NO
OF
LEVE
LS

PCM CODE

VALUES

NO
OF
LEVE
LS

PCM CODE

VALUES

31

111111

-0

000000

30

111110

-1

000001

29

111101

-2

000010

28

111100

-3

000011

27

111011

-4

000100

26

111010

-5

000101

25

111001

-6

000110

24

111000

-7

000111

23

110111

-8

001000

22

110110

-9

001001

21

110101

-10

001010

20

110100

-11

001011

19

110011

-12

001100

18

110010

-13

001101

17
16
15

110001
110000
101111

-14
-15
-16

001110
001111
010000

14

101110

-17

010001

13

101101

-18

010010

12

101100

9.6875V < Vin <10V


9.375V < Vin <
9.6875V
9.0625V < Vin <
9.375V
8.75V < Vin <
9.0625V
8.4375V < Vin <
8.75V
8.125V < Vin <
8.4375V
7.8125V < Vin <
8.125V
7.5V < Vin <
7.8125V
7.8175V < Vin <
7.5V
6.875V < Vin <
7.1875V
6.5625V < Vin <
6.875V
6.25V < Vin <
6.5625V
5.9375V < Vin <
6.25V
5.625V < Vin <
5.9375V
5.3125V < Vin <
5.625V
5V < Vin < 5.3125V
4.6875V < Vin < 5V
4.375V < Vin <
4.6875V
4.0625V < Vin <
4.375V
3.75V < Vin <
4.0625V

-19

010011

0.3125V < Vin < 0V


0.625V < Vin <
0.3125V
0.9375V < Vin <
0.625V
1.25V < Vin <
0.9375V
1.5625V < Vin <
1.25V
1.875V < Vin <
1.5625V
2.1875V <Vin <
1.875V
2.5V < Vin <
2.1875V
2.8125V < Vin <
2.5V
3.125V < Vin <
2.8125V
3.4375V < Vin <
3.125V
3.75V < Vin <
3.4375V
4.0625V < Vin <
3.75V
4.375V < Vin <
4.0625V
4.6875V < Vin <
4.375V
5V < Vin < 4.6875V
5.3125V < Vin < 5V
5.635V < Vin <
5.3125V
5.9375V < Vin <
5.635V
6.25V < Vin <
5.9375V

11

101011

10

101010

101001

101000

100111

100110

100101

100100

100011

100010

100001

3.4375V < Vin <


3.75V
3.125V < Vin <
3.4375V
2.8125V < Vin <
3.125V
2.5V < Vin <
2.8125V
2.8175V < Vin <
2.5V
1.875V < Vin <
2.1875V
1.5625V < Vin <
1.875V
1.25V < Vin <
1.5625V
0.9375V < Vin <
1.25V
0.625V < Vin <
0.9375V
0.3125V <Vin<
0.625V

100000

0V <Vin< 0.3125V

-20

010100

-21

010101

-22

010110

-23

010111

-24

011000

-25

011001

-26

011010

-27

011011

-28

011100

-29

011101

-30

011110

-31

011111

6.5625V < Vin <


6.25V
6.875V < Vin <
6.5625V
7.1875V < Vin <
6.875V
7.5V < Vin <
7.1875V
7.8125V < Vin <
7.5V
8.125V < Vin <
7.8125V
8.4375V < Vin <
8.125V
8.75V < Vin <
8.4375V
9.0625V < Vin <
8.75V
9.375V < Vin <
9.0625V
9.6875V < Vin <
9.375V
10V < Vin <
9.6875V

D. MATLAB AND SIMULINK


i.

We use Matlab program to simulate the system. The implemented values are the input for
the coding which are:
Modulating frequency, fm=3000Hz
Sampling frequency, fc= 8000Hz
Sampling time=1/8000 = 0.000125s
Number of bits=6
The coding are as follows:
%Code for Communication System Project
%Pulse code modulation for narrowband signal
%Azrul-Mira-Khairi-Firdaus
%Dr.Norazizah
%Section 2
clc;
close all;
clear all;
n=input('Enter n value for n-bit PCM system : ');
fa=input('Enter the input signal frequency : ');
fs=input('Enter the sampling frequency : ');
Ta=1/fa;
Ts=1/fs;
L=2^n;
% Sampling Operation
t=0:0.1*Ts:10*Ts;
w=2*pi*fa;
s=10*sin(w*t);
subplot(3,1,1);
plot(s);
title('Analog Signal');
ylabel('Amplitude');
xlabel('Time');
subplot(3,1,2);
stem(s);grid on; title('Sampled Signal'); ylabel('Amplitude');
xlabel('Time');
% Quantization Process
vmax=10;
vmin=-vmax;
del=(vmax-vmin)/L;
part=vmin:del:vmax; % level are between vmin and vmax with difference of
del
code=vmin-(del/2):del:vmax+(del/2); % Contain Quantized values
[ind,q]=quantiz(s,part,code); % Quantization process
% ind contain index number and q contain quantized values
l1=length(ind);
l2=length(q);
for i=1:l1
if(ind(i)~=0) % To make index as binary decimal so started from 0 to N
ind(i)=ind(i)-1;
end
i=i+1;
end
for i=1:l2
if(q(i)==vmin-(del/2)) % To make quantize value inbetween the levels

q(i)=vmin+(del/2);
end
end
subplot(3,1,3);
stairs(q);grid on; % Display the Quantize values
title('Quantized Signal');
ylabel('Amplitude');
xlabel('Time');
% Encoding Process
figure
code=de2bi(ind,'left-msb'); % Convert the decimal to binary
k=1;
for i=1:l1
for j=1:n
coded(k)=code(i,j); % convert code matrix to a coded row vector
j=j+1;
k=k+1;
end
i=i+1;
end
subplot(2,1,1); grid on;
stairs(coded);
% Display the encoded signal
axis([0 100 -2 3]); title('Encoded Signal');
ylabel('Amplitude');
xlabel('Time');
% Demodulation Of PCM signal
qunt=reshape(coded,n,length(coded)/n);
index=bi2de(qunt','left-msb'); % Getback the index in decimal form
q=del*index+vmin+(del/2); % getback Quantized values
subplot(2,1,2); grid on;
plot(q);
% Plot Demodulated signal
title('Demodulated Signal');
ylabel('Amplitude');
xlabel('Time');

i.

Results:

Figure 1: The input in the command window that we used where sampling
frequency is 8000Hz and modulating frequency is 3000Hz.

Figure 2: The results of the input. It shows the input is affected by sampling
frequency to produce the sampled signal and quantized signal.

Figure 3: The output of encoded signal and demodulated signal. The encoded
signal is the signal where it is digitalized, changing the analog quantized signal
into digital signal. We can see that the demodulated signal is the same as the
input signal. So we manage to recover the message signal.

PART B: DIGITAL

MODULATION

Truth Table: BPSK ( N=1,

Binary
Input

Output
phase

180

M=2)

Block Diagram:

Modulation and Demodulation


of BPSK

Generating
BPSK
Constellation
Diagram:

cos c t

sin c t

sin c t (180 )
Logic
1

Logic
0

cos c t
\

( 0 )

Based on the previous part A, from the PCM signal we need to transmit the data.
Hence, in order for us to transmit the PCM signal, we are required to convert the signal from
digital back to analog. We choose to use the Binary Phase Shift Keying (BPSK) as our digital
modulation technique. This is because, BPSK is one of the easiest and simplest way for us to
encode the data. The advantage of using BPSK it is more reliable in terms of data accuracy.
Even though BPSK only modulate one bit per symbol but it is also one of the robust for all
the PSKs since it takes the highest level of noise or distortion to make the demodulator reach
an incorrect decision. However, the disadvantage of using BPSK is that it requires higher
bandwidth in order to transmit the data. On top that, we use sin c t

as the reference carrier

frequency.

%Code for Communication System Project


%BPSK Signal coding for narrowband signal
%Azrul-Mira-Khairi-Firdaus
%Dr.Norazizah
%Section 2
clc;
close all;
clear all;
n=input('Enter n value for n-bit PCM system : ');
fa=input('Enter the input signal frequency : ');
fs=input('Enter the sampling frequency : ');
Ta=1/fa;
Ts=1/fs;
L=2^n;
% Sampling Operation
t=0:0.1*Ts:10*Ts;
w=2*pi*fa;
s=10*sin(w*t);
subplot(3,1,1);
plot(s);
title('Analog Signal');
ylabel('Amplitude');
xlabel('Time');
subplot(3,1,2);
stem(s);grid on; title('Sampled Signal'); ylabel('Amplitude');
xlabel('Time');
% Quantization Process
vmax=10;
vmin=-vmax;
del=(vmax-vmin)/L;
part=vmin:del:vmax; % level are between vmin and vmax with difference of
del
code=vmin-(del/2):del:vmax+(del/2); % Contain Quantized values
[ind,q]=quantiz(s,part,code); % Quantization process
% ind contain index number and q contain quantized values
l1=length(ind);
l2=length(q);

for i=1:l1
if(ind(i)~=0) % To make index as binary decimal so started from 0 to N
ind(i)=ind(i)-1;
end
i=i+1;
end
for i=1:l2
if(q(i)==vmin-(del/2)) % To make quantize value inbetween the levels
q(i)=vmin+(del/2);
end
end
subplot(3,1,3);
stairs(q);grid on; % Display the Quantize values
title('Quantized Signal');
ylabel('Amplitude');
xlabel('Time');
% Encoding Process
figure
code=de2bi(ind,'left-msb'); % Convert the decimal to binary
k=1;
for i=1:l1
for j=1:n
coded(k)=code(i,j); % convert code matrix to a coded row vector
j=j+1;
k=k+1;
end
i=i+1;
end
subplot(2,1,1); grid on;
stairs(coded); % Display the encoded signal
axis([0 100 -2 3]); title('Encoded Signal');
ylabel('Amplitude');
xlabel('Time');
% Demodulation Of PCM signal
qunt=reshape(coded,n,length(coded)/n);
index=bi2de(qunt','left-msb'); % Getback the index in decimal form
q=del*index+vmin+(del/2); % getback Quantized values
subplot(1,1,1); grid on;
plot(q);
% Plot Demodulated signal
title('Demodulated Signal');
ylabel('Amplitude');
xlabel('Time');

%>>>>>>>>> MATLAB code for binary PSK modulation and de-modulation >>>>>>>
%
r=[coded];
Information
bp=0.00033
disp('Binary information at Trans mitter:');
disp(r);

% Binary
% bit period

%XX representation of transmitting binary information as digital signal XXX


bit=[];
for n=1:1:length(r)

if r(n)==1;
se=ones(1,100);
else r(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t1=bp/100:bp/100:100*length(r)*(bp/100);
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(r) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('transmitting information as digital signal');

%XXXXXXXXXXXXXXXXXXXXXXX Binary-PSK modulation XXXXXXXXXXXXXXXXXXXXXXXXXXX%


A=10;
% Amplitude of carrier
signal
br=1/bp;
% bit rate
f=br*2;
% carrier frequency
t2=bp/99:bp/99:bp;
ss=length(t2);
m=[];
for (i=1:1:length(r))
if (r(i)==1)
y=A*cos(2*pi*f*t2);
else
y=A*cos(2*pi*f*t2+pi);
%A*cos(2*pi*f*t+pi) means -A*cos(2*pi*f*t)
end
m=[m y];
end
t3=bp/99:bp/99:bp*length(r);
subplot(3,1,2);
plot(t3,m);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('waveform for binary PSK modulation coresponding binary
information');

%XXXXXXXXXXXXXXXXXXXX Binary PSK demodulation XXXXXXXXXXXXXXXXXXXXXXXXXXXXX


mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y=cos(2*pi*f*t);
% carrier siignal
mm=y.*m((n-(ss-1)):n);
t4=bp/99:bp/99:bp;
z=trapz(t4,mm)
% intregation
zz=round((2*z/bp))
if(zz>0)
% logic level = (A+A)/2=0
%becouse A*cos(2*pi*f*t+pi) means -A*cos(2*pi*f*t)
a=1;
else
a=0;
end

mn=[mn a];
end
disp(' Binary information at Reciver :');
disp(mn);

%XXXXX Representation of binary information as digital signal which achived


%after PSK demodulation XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
bit=[];
for n=1:length(mn);
if mn(n)==1;
se=ones(1,100);
else mn(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t4=bp/100:bp/100:100*length(mn)*(bp/100);
subplot(3,1,3)
plot(t4,bit,'LineWidth',2.5);grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('received information as digital signal after binary PSK
demodulation');
%>>>>>>>>>>>>>>>>>>>>>>>>>> end of program >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>%

Figure 4: The input command window of the coding.

Figure 5: The analog, sampled and quantized signal of the input.

Figure 6: The binary encoded signal is modulated using the BPSK signal and we
can see that the waveform is changed when the bit transit from bit 0 to bit 1. The
phase is 180 degree difference.