TELKOM
NIKA
, Vol. 11, No. 10, Octobe
r 2013, pp. 5
973 ~ 5
979
ISSN: 2302-4
046
5973
Re
cei
v
ed Fe
brua
ry 24, 20
13; Re
vised Ju
ly 9, 201
3; Accepted
Jul
y
20, 2013
MATLAB Based PCM Modeling and Simulation
Yongchao Ji
n
1
, Hong Liang*
2
, Wei
w
e
i
Feng
2
, Qiong Wang
1
1
Colle
ge of Architectura
l an
d Engi
neer
in
g, Yunn
an Agr
i
cult
ural U
n
ivers
i
t
y
,
Kunmin
g, Chi
n
a
2
School of Infor
m
ation Sci
enc
e and En
gi
neer
ing, Yun
n
a
n
U
n
iversit
y
, Kun
m
ing, Ch
ina
*Corres
p
o
ndi
n
g
author, e-ma
i
l
: jin
yo
ngc
h
a
o
@
yna
u
.edu.c
n
*, y
n
l
i
a
ngh
@1
2
6
.com
A
b
st
r
a
ct
PCM is the key technol
ogy o
f
digital co
mmunic
a
tion, a
nd
has esp
e
cia
lly
bee
n w
i
dely us
ed in th
e
optica
l
fib
e
r c
o
mmunic
a
tio
n
, di
gital
microw
ave c
o
mm
un
ic
ation, s
a
tell
ite
communic
a
tio
n
.
Mode
lin
g PC
M
communic
a
tion system
s
with the
puls
e
code
system
by
pr
ogramming, and conduct
co
m
puter sim
u
lation by
MAT
L
AB, to analysis p
e
rfor
ma
nce of the li
nea
r PCM and lo
g
a
rith
mic PCM.
Ke
y
w
ords
: PC
M mod
e
li
ng, S
NR, qua
ntitativ
e, co
mpressi
on
feature, simul
a
tion a
n
a
l
ysis
Copy
right
©
2013 Un
ive
r
sita
s Ah
mad
Dah
l
an
. All rig
h
t
s r
ese
rved
.
1. Introduc
tion
Pulse Co
de Modulatio
n,
referred
to as
PCM.
It is
a kin
d
of e
n
c
odi
ng that
chang
es
analo
g
voi
c
e
sign
al into
di
gital si
gnal
[1
]. In the late
1970
s,
with
the a
ppe
ara
n
c
e
of p
u
lse
code
modulatio
n e
n
co
der an
d
decode
r fo
r su
pe
r-la
r
ge
-scale i
n
tegra
t
ed ci
rcuit a
s
well
as t
he
developm
ent
of opti
c
al
fiber
comm
u
n
icatio
n, digi
tal micro
w
av
e commu
nications,
satell
ite
comm
uni
cati
ons, PCM h
a
s
bee
n gra
d
u
a
lly widely used. At prese
n
t, the PCM has be
com
e
a key
techn
o
logy in
digital comm
unication [2-6
].
2. Rese
arch
Metho
d
PCM m
odul
ation m
a
inly
incl
ude
s sampling,
qu
antizatio
n a
nd e
n
codin
g
process.
Sampling
ch
ange
s th
e co
ntinuou
s
anal
og
signal
s i
n
to the
discrete time
contin
uou
s am
plitu
d
e
sampli
ng sig
nals; Quantif
ication ch
an
ges
t
he di
screte time
co
ntinuou
s a
m
plitude
sam
p
ling
sign
als into t
he discrete time discrete
amp
litude
dig
i
tal signal
s;
Codi
ng ma
ke
s the qu
antified
sign
als into t
he output bin
a
ry co
de gro
ups. In
ternati
onal sta
nda
rd
PCM co
de g
r
oup
s (tel
eph
one
voice)
ado
pt eight-level
co
des
rep
r
e
s
e
n
t
s a samplin
g value [1]. From th
e view of mod
u
lat
i
on
con
c
e
p
t in
communi
catio
n
, it can
be
con
s
id
ere
d
t
hat, the P
C
M en
co
ding
pro
c
e
s
s i
s
a
nalog
sign
al modul
ating a binary pulse se
qu
ence, t
he ca
rrie
r
is pul
se
seque
nce, and mod
u
lati
on
cha
nge
s p
u
l
s
e
seq
uen
ce
as
non
e o
r
"1", "0", therefo
r
e P
C
M
is m
ade i
n
to pulse
co
de
modulatio
n. Pulse
cod
e
mo
dulation p
r
o
c
ess as
sho
w
n
in Figure 1.
Encod
ed P
C
M co
de g
r
o
ups, via
digi
tal cha
nnel
s,
can
be
directly tran
smi
tted by
baseba
nd o
r
microwave,
light wave
carri
er m
odul
a
t
ed pa
ss ba
n
d
. At the re
ceiving en
d, the
binary code
grou
p inversely transform
s into the reco
nstructio
n
analog si
gn
al
)
(
ˆ
t
x
. In t
h
e
demod
ulation
pro
c
e
s
s, ge
nerally
use
s
the sa
mpli
ng h
o
l
d
c
i
rc
u
i
t,
s
o
th
e low
pa
ss
filte
r
ad
op
ts
x
x
sin
type frequen
cy to resp
on
se to com
p
e
n
sate for fre
q
uen
cy distorti
on
x
x
sin
introd
uce
d
b
y
sampli
ng hol
d circuit is.
Pre-filteri
ng i
s
to limit the
origin
al sp
e
e
ch
sign
al freque
ncy ba
n
d
within 3
0
0
-
3400
Hz
stand
ard
lon
g
-di
s
tan
c
e
an
alog tel
eph
on
e fre
quen
cy
band.
Du
e to
the o
r
igin
al
spe
e
ch b
and
is
arou
nd 40
-1
0
000 Hz, so p
r
e-filter can m
ade out certai
n band di
stort
i
on.
In the entire
PCM syste
m
, the dist
ortio
n
of recon
s
truction
sign
al
)
(
ˆ
t
x
mainly results
from qu
antification a
s
well as the
ch
an
nel tran
sm
i
ssion erro
r, ge
nerally d
enot
es a
s
the
sig
nal
and the qu
ant
ization n
o
ise power ratio,
namely is sig
n
a
l-to-noi
se rat
i
o S/N.
Evaluation Warning : The document was created with Spire.PDF for Python.
ISSN: 23
02-4
046
TELKOM
NIKA
Vol. 11, No
. 10, Octobe
r 2013 : 597
3 –
5979
5974
Figure 1. PCM modulatio
n
theory figure
3. Linear PCM and Logar
i
thmic PCM Performan
c
e
Analy
s
is
Here take
s si
nusoidal
sign
al as the exa
m
pl
e to anal
ysis SNR fea
t
ures of line
a
r PCM
encodin
g
and
logarithmi
c
PCM en
codi
ng
.
3.1. Uniform
Quan
tifica
tion
Based o
n
the communi
catio
n
theory, when
inputs sinu
soid
al
sign
al
)
*
*
1
.
0
sin(
*
x
pi
A
a
m
, and the si
gnal i
s
not over lo
a
ded, if take
the qua
ntitative
interval n
u
m
ber a
s
L
, and
n
L
2
,
n
is a po
sit
i
ve intege
r, the
n
n
D
SNR
02
.
6
log
20
77
.
4
It is measu
r
e
d
in deci
bel
s (dB),
V
A
D
m
2
/
,
V
as the larg
est q
u
antizatio
n level.
Within the scope of the load ran
ge, SNR a
ppea
rs
linearly in
cre
a
s
ed
with the increa
se of the
input sig
nal.
3.2. Non-u
n
iform Quanti
fication
1) Ala
w
Com
p
ression F
e
ature
s
Assu
ming th
at the input sinusoidal
sig
nal
)
*
*
1
.
0
sin(
x
pi
a
's pha
se i
s
ra
ndo
m, an
d
equal
-p
roba
bi
lity distributed
within the scope of
,
. Then:
Quanti
z
ation noise
po
wer
A
a
L
A
C
q
/
1
0
,
3
1
2
2
2
2
1
/
1
},
1
2
)
(
)
1
(
sin
]
)
(
2
{[
3
1
2
2
2
1
2
2
2
2
2
a
A
A
a
aA
aA
aA
L
A
C
q
)
1
/(
1
InA
C
,
6
.
87
A
And Sinusoid
a
l instanta
n
e
ous p
o
wer
2
2
a
S
Based th
ree
formula
s
abo
ve, it can de
velop pro
g
ra
ms belo
w
, an
d come o
u
t the input
ar
rays
sample values
x
and
SNR. And draw out the S
NR
curve.
x=0:0.01:20;
a=sin(0.1*pi*
x
);
a2=
max(a);
%
for the maximum amplitude
b=le
ngth(a);
analo
g
sign
al
source
pre
-
filter
sampl
e
r
Wav
e
fo
rm en
cod
e
r
Quantification
,
coding
digital ch
ann
el
waveform dec
o
der
r
e
co
ns
tr
uc
tion
filte
r
sampl
e
hold,
x/sinx low pa
ss
virtual termin
al
Tran
smitting end
receiving en
d
Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM
NIKA
ISSN:
2302-4
046
MATLAB Based PCM Mod
e
ling an
d Simulation (Hon
g
Liang)
5975
a1=ab
s(a
)
;
% for the absol
ute value
of the input signal
X=20*l
og10
(a
1/a2);
n=8;
SNR1
=6.0
2*
n+4.7
7
+X; % uniform qu
antizatio
n SNR
plot(X,SNR1)
axis([-80 0 0
70]);
ylabel('S
N
R(d
B
)');xlabel
('2
0
l
ogD'
)
;
grid on
text('Position'
,[-30,15],'String','L
=25
6');
hold on
A=87.6;
C=
1/(1
+log
(A
));
S1=
a
.^2;
S=S1./2;
%sinu
s
oid
a
l signal po
we
r
for i=
1:b
L=
256;
%L=
2
^8(n=
8
)
if a1(i)<=1/A
q=1/(3*(C*A*
L)^2);
else
q=1/(3*pi*
(C*
A
*L)^2)*((2-
(a1
(
i)*A
)^2)*
(
asin
(1/(
a1(i
)
*
A
)))
+pi*
(a
1(i
)
*
A
)^2/2+
sq
rt((
a1(i
)
*A)^2
-
1
)
)
;
end
Q(i)=
q
;
%Plac
e
the nois
e power at
Array Q
end
S21=
S./Q;
SNR2
1=10*lo
g10(S
21);
No
n-unifo
rm
qu
antizatio
n SNR
when
% n
= 8
sin
u
soida
l
sig
n
a
l
input
plot(X,SNR21)
text('Position'
,[-30,40],'String','L
=25
6');
hold on
for i=
1:b
L=
64;
%
L
=
2
^6(n=
6
)
if a1(i)<=1/A
q=1/(3*(C*A*
L)^2);
else
q=1/(3*pi*
(C*
A
*L)^2)*((2-
(a1
(
i)*A
)^2)*
(
asin
(1/(
a1(i
)
*
A
)))
+pi*
(a
1(i
)
*
A
)^2/2+
sq
rt((
a1(i
)
*A)^2
-
1
)
)
;
end
Q(i)=q;
end
S22=
S./Q;
SNR2
2=10*lo
g10(S
22);
No
n-unifo
rm
qu
antizatio
n SNR
when
% n
= 6
sin
u
soida
l
sig
n
a
l
input
plot(X,SNR22)
text('Position'
,[-9,28],'String','L=64'
);
title ( ‘logarith
m
ic co
mpression PCM, linear PCM
sn
r feature
s
’)
Figure 2 is the result of the prog
ram ru
nning.
The
straight line in
Figure is the uniform
quanti
z
ation
whe
n
n = 8 si
nusoidal si
gn
al input, tw
o curve
s
respe
c
tively represents no
n-u
n
iform
quanti
z
ation
SNR when n
= 8 sin
u
soida
l
signal in
put, and n = 6
sin
u
soi
dal si
gnal
input.
Evaluation Warning : The document was created with Spire.PDF for Python.
ISSN: 23
02-4
046
TELKOM
NIKA
Vol. 11, No
. 10, Octobe
r 2013 : 597
3 –
5979
5976
Figure 2. Log
arithmi
c
com
p
re
ssi
on
PCM, linear PCM snr featu
r
e
s
2) Ala
w
1
3
Line Compr
e
s
s
ion Feature
s
There are two method
s to
cal
c
ulate the
Alaw
13 lin
e
SNR: First, the direct
cal
c
ulation
method, that
is di
re
ctly u
s
ing t
he Ala
w
13
lin
e
co
mpre
ssion &
expan
sion
cha
r
a
c
teri
stics to
cal
c
ulate the
quanti
z
ation
noise and qu
antizatio
n SN
R; Secon
d
, the indire
ct cal
c
ulatio
n meth
od
,
that is, to firstly cal
c
ulate
the uniform
quantization
noise and uniform quan
tization
SNR
in
accordan
ce
with the unif
o
rm qu
antiza
t
ion, t
hen to cal
c
ulate the
SNR imp
r
ov
ement qu
anti
t
ies
resulted fro
m
the com
p
ressio
n & e
x
pansi
on,
then the sum
of them is the non-uni
form
quanti
z
ation
SNR. He
re ta
ke
s the se
co
nd me
thod to
con
d
u
c
t simul
a
tion, that is:
In the formula
dB
dB
q
dB
q
Q
N
S
N
S
dB
q
N
S
is the non-un
iform qua
ntization SNR
dB
q
N
S
is the uniform quantizatio
n SNR
dB
Q
is the SNR i
m
provem
ent quantitie
s.
In the
above
formul
a, the
r
e i
s
no
co
n
s
ide
r
ation
wit
h
ove
r
lo
ade
d noi
se,
be
cause the
cal
c
ulatio
n of overload
ed
noise, either
by unifo
rm q
uantization or non-uni
form quanti
z
ation, the
cal
c
ulatio
n m
e
thod
s and f
o
rmul
as a
r
e
all the
sam
e
, the SNR im
provem
ent q
uantities in t
he
formula sho
u
l
d
be
)
/
1
log(
10
dB
Q
Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM
NIKA
ISSN:
2302-4
046
MATLAB Based PCM Mod
e
ling an
d Simulation (Hon
g
Liang)
5977
In this
formula,
1
1
2
)
(
1
da
a
p
da
dy
is the 13 line
Approximatio
n method imp
r
oveme
n
t factors
y
—Qua
ntitative output sig
n
a
l;
a
—Input sig
nal
;
)
(
a
p
—Prob
ability den
sity of normalize
d
sig
n
a
l
amplitude;
da
dy
—Segme
n
t of the slope of
corre
s
p
ondin
g
line.
If taking the audio si
gnal a
s
the input sig
nal, then the SNP can b
e
dB
dB
q
Q
u
a
n
N
S
log
20
77
.
4
6
Becau
s
e the
sinu
soi
dal sig
nal’s p
r
ob
abili
ty density is
2
2
1
1
)
(
a
u
a
P
In this
formula,
a
—Instanta
n
e
ous valu
e of sinu
soi
dal sig
nal;
u
—Peak valu
e
of sinusoidal
sign
al.
Then the imp
r
oveme
n
t factor is
1
0
2
2
2
1
1
2
da
a
u
da
dy
For the re
aso
n
that there are differen
c
e
s
in
slope at each pa
ra
gra
p
h
s of the 13 line, in
the spe
c
ific
calcul
ation, it is sh
ould a
ccordin
g
to the amount of the instanta
neo
us value of in
put
sign
al to inte
grate
with ea
ch p
a
ra
gra
p
h
s
, impr
oveme
n
t factor a
nd
at each pa
rag
r
aph
s
cal
c
ula
t
ed
as:
The 1
st
, 2
nd
parag
ra
ph:
256
1
2
1
The 3
rd
parag
raph:
)
2
1
arcsin
2
3
1
(
64
1
3
The fourth p
a
r
ag
rap
h
:
)
4
1
arcsin
2
3
1
(
64
1
4
3
4
The fifth paragraph:
)
8
1
arcsin
2
3
1
(
64
1
4
4
5
The sixth pa
ragra
ph:
)
16
1
arcsin
2
3
1
(
64
1
4
5
6
The seve
nth para
g
raph:
)
32
1
arcsin
2
3
1
(
64
1
4
6
7
Evaluation Warning : The document was created with Spire.PDF for Python.
ISSN: 23
02-4
046
TELKOM
NIKA
Vol. 11, No
. 10, Octobe
r 2013 : 597
3 –
5979
5978
The eighth p
a
r
ag
rap
h
:
)
64
1
arcsin
2
3
1
(
64
1
4
7
8
Acco
rdi
ng to
the above method, it can be
de
sig
ned into the followin
g
pro
g
ram a
n
d
figured o
u
t the 13 line en
coding SNR curve wh
en th
e input is the
sinu
soi
dal sig
nal:
x=0:0.01:20;
a=sin(0.1*pi*
x
);
a2=m
a
x(a
)
;
% for the
maximum am
plitude
b=le
ngth(a);
a1=ab
s(a
)
;
% for the absol
ute value
of the input signal
X=20*l
og10
(a
1/a2);
n=8;
SNR1
1=6.02
*n+4.7
7+X; % Uniform
quanti
z
ation
SNR
plot(X,SNR11
)
axis([-80 0 0
60]);
ylabel('S
N
R(d
B
)');xlabel
('2
0
l
ogD (In
s
tant
aneo
us valu
e
/
peak valu
e)'
)
;
grid on
text ('Position
',[-35,15],'Stri
ng', 'linea
r qu
antizin
g n=8');
hold on
B(1)=
1
/256;
B(2)=
1
/256;
B(3)=
1
/64*(1-3/(2*pi)*as
in(1/2));
%
for improvement fac
t
ors
B(4)=B(3
)*4
-
1/64*3/(2*pi
)
*
a
sin
(
1/4
)
;
B(5)=B(4
)*4
-
1/64*3/(2*pi
)
*
a
sin
(
1/8
)
;
B(6)=B(5
)*4
-
1/64*3/(2*pi
)
*
a
sin
(
1/16
);
B(7)=B(6
)*4
-
1/64*3/(2*pi
)
*
a
sin
(
1/32
);
B(8)=B(7
)*4
-
1/64*3/(2*pi
)
*
a
sin
(
1/64
);
n=8;
A=87.6;
for i=
1:b
a1=a(i
)
*(2^11
-1);
C=pcm
a
d
(
8,a
1
);
% 13 line en
codi
ng
C1=
C
(2:4);
%
tak
e
the 2
nd
and fourth
numbe
r of the cod
e
S=exda
c(3,C1);
%
for para
g
raph
s=B
(
S+1);
% for improvement facto
r
s with the co
rresp
ondi
ng pa
rag
r
ap
h
w=-10
*
log1
0(s); % loga
rithmic of imp
r
oveme
n
t factors
Q(i)=w;
%
plac
e in Array Q(i)
end
W=6*n
+
4.77;
SNR2
1=
W
+
X
+
Q;
plot(X,SNR21
)
text ('Position
',[-70,32],'Stri
ng', 'linea
r qu
antizin
g n=8');
title (‘Sinusoi
dal input snr feature
s
(13 li
ne app
roxima
tion)’)
Figure 3 is the result of the prog
ram ru
nning.
Th
rou
gh the Figure
can be seen
that with
the 13 line
approximation of Alaw
compression feature,
SNR
curve will appea
r fluctuations, and
it is no longe
r the smooth
curve, there a
r
e 6 trough
s, 7
pea
ks in total
.
Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM
NIKA
ISSN:
2302-4
046
MATLAB Based PCM Mod
e
ling an
d Simulation (Hon
g
Liang)
5979
Figure 3. Sinusoi
dal input
SNR f
eatu
r
e
s
(13 line ap
proximation).
4. Conclusio
n
PCM has b
e
en as the ke
y technology
in the modern digital co
mmuni
cation
s, which
occupi
es a
n
i
m
porta
nt po
sition in the communi
ca
tio
n
engin
e
e
r
in
g. In this pa
per P
C
M sy
stem
simulatio
n
wa
s e
s
tablished
base
d
on th
e Matlab an
d
comp
arative
analysi
s
on t
he pe
rform
a
n
c
e
of the linea
r
PCM an
d log
a
rithmi
c PCM
,
and the gi
ve
n sp
ecifi
c
exa
m
ples
ca
n p
r
ovide refe
re
n
c
e
for other
com
m
unication sy
stem sim
u
lati
on analy
s
is.
Referen
ces
[1]
Z
h
iga
ng Ca
o, Yashe
ng Qia
n
. Modern C
o
m
m
unic
a
tion Pri
n
cipl
es. Beij
in
g
:
tsinghua
univ
e
rsit
y
pr
ess.
199
2.
[2]
Huaic
h
e
ng
Ch
eng,
Dazh
en
g
W
u
, Gai
x
i
Quan. MAT
L
AB an
d Its Ap
plicati
o
n
in
El
ectronic
an
d
Information C
o
urses. Beij
ing:
Elec
tron
ic Indu
str
y
Press. 200
2.
[3]
Liju
n Z
h
en
g,Qihen
g Yi
ng,W
e
i
l
i
Ya
ng. S
i
gn
als
an
d S
y
stems
(
s
econ
d
editi
on)
. Beij
ing:
Hi
ghe
r Educ
atio
n
Press. 2000.
[4]
Hua De
ng. MAT
L
AB Simulation a
nd Co
mmunicati
on
Appl
icatio
n Exampl
e Expla
n
a
tion. Bei
jin
g:
Peop
le'
s
Posts and T
e
lecom
m
unic
a
tions Pr
ess. 2003.
[5]
Hon
g
L
i
an
g, Y
uan
yu
a
n
Pu, J
i
eli
a
n
g
. Sig
n
a
l
and
li
near
S
y
stem An
al
ysis:
Method
Base
d
on MAT
L
AB
and Impl
ement
ation. Bei
jin
g: Hig
h
e
r Educ
ati
on Press. 20
06
.
[6]
Lia
ng Ji
a-Ha
i, Jin Yo
ng-C
hao
, Jia Jin-N
i
ng.
Rese
arch of M
ode
lin
g an
d Si
mulati
on of Sh
rimp F
a
rmin
g
Process Bas
e
d on A
gent.
J
ourn
a
l of yu
nn
an a
g
ricu
ltural
univ
e
rsity: na
tural scie
n
ce
editi
on
. 20
11
;
26(6): 86
6-8
7
1
.
13
Li
ne
q
u
a
n
t
i
zat
i
on:
n
=
8
lin
ear q
u
a
n
tizin
g
:
n=8
20l
og
D
(peaks
)
Evaluation Warning : The document was created with Spire.PDF for Python.