0% found this document useful (0 votes)
132 views

MATLAB Based PCM Modeling and Simulation

Uploaded by

Pawan Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views

MATLAB Based PCM Modeling and Simulation

Uploaded by

Pawan Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

TELKOMNIKA, Vol. 11, No. 10, October 2013, pp.

5973 ~ 5979
e-ISSN: 2087-278X
 5973

MATLAB Based PCM Modeling and Simulation

Yongchao Jin1, Hong Liang*2, Weiwei Feng2, Qiong Wang1


1
College of Architectural and Engineering, Yunnan Agricultural University, Kunming, China
2
School of Information Science and Engineering, Yunnan University, Kunming, China
*Corresponding author, e-mail: [email protected]*, [email protected]

Abstract
PCM is the key technology of digital communication, and has especially been widely used in the
optical fiber communication, digital microwave communication, satellite communication. Modeling PCM
communication systems with the pulse code system by programming, and conduct computer simulation by
MATLAB, to analysis performance of the linear PCM and logarithmic PCM.

Keywords: PCM modeling, SNR, quantitative, compression feature, simulation analysis

Copyright © 2013 Universitas Ahmad Dahlan. All rights reserved.

1. Introduction
Pulse Code Modulation, referred to as PCM. It is a kind of encoding that changes
analog voice signal into digital signal [1]. In the late 1970 s, with the appearance of pulse code
modulation encoder and decoder for super-large-scale integrated circuit as well as the
development of optical fiber communication, digital microwave communications, satellite
communications, PCM has been gradually widely used. At present, the PCM has become a key
technology in digital communication [2-6].

2. Research Method
PCM modulation mainly includes sampling, quantization and encoding process.
Sampling changes the continuous analog signals into the discrete time continuous amplitude
sampling signals; Quantification changes the discrete time continuous amplitude sampling
signals into the discrete time discrete amplitude digital signals; Coding makes the quantified
signals into the output binary code groups. International standard PCM code groups (telephone
voice) adopt eight-level codes represents a sampling value [1]. From the view of modulation
concept in communication, it can be considered that, the PCM encoding process is analog
signal modulating a binary pulse sequence, the carrier is pulse sequence, and modulation
changes pulse sequence as none or "1", "0", therefore PCM is made into pulse code
modulation. Pulse code modulation process as shown in Figure 1.
Encoded PCM code groups, via digital channels, can be directly transmitted by
baseband or microwave, light wave carrier modulated pass band. At the receiving end, the
binary code group inversely transforms into the reconstruction analog signal xˆ ( t ) . In the
demodulation process, generally uses the sampling hold circuit, so the low pass filter adopts
x sin x
sin type frequency to response to compensate for frequency distortion x introduced by
x
sampling hold circuit is.
Pre-filtering is to limit the original speech signal frequency band within 300-3400 Hz
standard long-distance analog telephone frequency band. Due to the original speech band is
around 40-10000 Hz, so pre-filter can made out certain band distortion.
In the entire PCM system, the distortion of reconstruction signal xˆ ( t ) mainly results
from quantification as well as the channel transmission error, generally denotes as the signal
and the quantization noise power ratio, namely is signal-to-noise ratio S/N.

Received February 24, 2013; Revised July 9, 2013; Accepted July 20, 2013
5974  e-ISSN: 2087-278X

Waveform encoder
analog signal source pre-filter sampler Quantification, coding

Transmitting end
digital channel
receiving end

reconstruction filter
virtual terminal sample hold, x/sinx low pass waveform decoder

Figure 1. PCM modulation theory figure

3. Linear PCM and Logarithmic PCM Performance Analysis


Here takes sinusoidal signal as the example to analysis SNR features of linear PCM
encoding and logarithmic PCM encoding.

3.1. Uniform Quantification


Based on the communication theory, when inputs sinusoidal
a  Am * sin(0.1 * pi * x) , and the signal is not over loaded, if take the quantitative
signal
interval number as L , and L  2n , n is a positive integer, then
SNR  4.77  20 log D  6.02 n
It is measured in decibels (dB), D  A m / 2V , V as the largest quantization level.
Within the scope of the load range, SNR appears linearly increased with the increase of the
input signal.

3.2. Non-uniform Quantification

1) Alaw Compression Features


Assuming that the input sinusoidal signal a  sin( 0.1 * pi * x ) 's phase is random, and
equal-probability distributed within the scope of
  ,   . Then:
Quantization noise power
1
 q2  ,0  a  1 / A
3C A 2 L2
2

1 1  (aA) 2
 q2  2 2 2 {[ 2  (aA) 2 ] sin 1 ( )   a 2 A 2  1},1 / A  a  1
3C A L aA 2
C  1 /(1  InA) , A  87 .6
a2
S 
And Sinusoidal instantaneous power 2

Based three formulas above, it can develop programs below, and come out the input
arrays sample values x and SNR. And draw out the SNR curve.

x=0:0.01:20;
a=sin(0.1*pi*x);
a2=max(a); % for the maximum amplitude
b=length(a);

TELKOMNIKA Vol. 11, No. 10, October 2013 : 5973 – 5979


TELKOMNIKA e-ISSN: 2087-278X  5975

a1=abs(a); % for the absolute value of the input signal


X=20*log10(a1/a2);
n=8;
SNR1=6.02*n+4.77+X; % uniform quantization SNR
plot(X,SNR1)
axis([-80 0 0 70]);
ylabel('SNR(dB)');xlabel('20logD');
grid on
text('Position',[-30,15],'String','L=256');
hold on
A=87.6;
C=1/(1+log(A));
S1=a.^2;
S=S1./2; %sinusoidal signal power
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*(a1(i)*A)^2/2+sqrt((a1(i)*A)^2-1));
end
Q(i)=q; %Place the noise power at Array Q
end
S21=S./Q;
SNR21=10*log10(S21); Non-uniform quantization SNR when % n = 8 sinusoidal signal
input
plot(X,SNR21)
text('Position',[-30,40],'String','L=256');
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*(a1(i)*A)^2/2+sqrt((a1(i)*A)^2-1));
end
Q(i)=q;
end
S22=S./Q;
SNR22=10*log10(S22); Non-uniform quantization SNR when % n = 6 sinusoidal signal
input
plot(X,SNR22)
text('Position',[-9,28],'String','L=64');
title ( ‘logarithmic compression PCM, linear PCM snr features’)

Figure 2 is the result of the program running. The straight line in Figure is the uniform
quantization when n = 8 sinusoidal signal input, two curves respectively represents non-uniform
quantization SNR when n = 8 sinusoidal signal input, and n = 6 sinusoidal signal input.

MATLAB Based PCM Modeling and Simulation (Hong Liang)


5976  e-ISSN: 2087-278X

Figure 2. Logarithmic compression PCM, linear PCM snr features

2) Alaw 13 Line Compression Features


There are two methods to calculate the Alaw 13 line SNR: First, the direct calculation
method, that is directly using the Alaw 13 line compression & expansion characteristics to
calculate the quantization noise and quantization SNR; Second, the indirect calculation method,
that is, to firstly calculate the uniform quantization noise and uniform quantization SNR in
accordance with the uniform quantization, then to calculate the SNR improvement quantities
resulted from the compression & expansion, then the sum of them is the non-uniform
quantization SNR. Here takes the second method to conduct simulation, that is:
In the formula

 S   S 

 N


    Q dB
 q  dB  N q  dB
 S 
 
 N 
 q  dB is the non-uniform quantization SNR
 S 
 
 N q  dB is the uniform quantization SNR
QdB is the SNR improvement quantities.

In the above formula, there is no consideration with over loaded noise, because the
calculation of overloaded noise, either by uniform quantization or non-uniform quantization, the
calculation methods and formulas are all the same, the SNR improvement quantities in the
formula should be

QdB  10 log(1 /  )

TELKOMNIKA Vol. 11, No. 10, October 2013 : 5973 – 5979


TELKOMNIKA e-ISSN: 2087-278X  5977

In this formula,

1 1
  2
p (a )da
1
 dy 
 da 
  is the 13 line Approximation method improvement factors
y —Quantitative output signal;
a —Input signal;
p ( a ) —Probability density of normalized signal amplitude;
dy
da —Segment of the slope of corresponding line.

If taking the audio signal as the input signal, then the SNP can be
 S 
   6n  4.77  20 log a  Q dB
N  u
 q  dB
Because the sinusoidal signal’s probability density is
1 1
P(a)  
 u  a2
2

In this formula,
a —Instantaneous value of sinusoidal signal;
u —Peak value of sinusoidal signal.
Then the improvement factor is
2 1 1 1

 2
 da
0
 dy  u  a2
2

 da 
 

For the reason that there are differences in slope at each paragraphs of the 13 line, in
the specific calculation, it is should according to the amount of the instantaneous value of input
signal to integrate with each paragraphs, improvement factor and at each paragraphs calculated
as:
1
1   2 
The 1st, 2nd paragraph: 256
1 3 1
 3  (1  arcsin )
The 3rd paragraph: 64 2 2
1 3 1
4  4  3 
(1  arcsin  )
The fourth paragraph: 64 2 4
1 3 1
 5  4   4  (1  arcsin  )
The fifth paragraph: 64 2 8
1 3 1
6  4  5 
(1  arcsin  )
The sixth paragraph: 64 2  16 
1 3  1 
 7  4   6  (1  arcsin  )
The seventh paragraph: 64 2  32 

MATLAB Based PCM Modeling and Simulation (Hong Liang)


5978  e-ISSN: 2087-278X

1 3  1 
8  4  7  (1  arcsin  )
The eighth paragraph: 64 2  64 
According to the above method, it can be designed into the following program and
figured out the 13 line encoding SNR curve when the input is the sinusoidal signal:

x=0:0.01:20;
a=sin(0.1*pi*x);
a2=max(a); % for the maximum amplitude
b=length(a);
a1=abs(a); % for the absolute value of the input signal
X=20*log10(a1/a2);
n=8;
SNR11=6.02*n+4.77+X; % Uniform quantization SNR
plot(X,SNR11)
axis([-80 0 0 60]);
ylabel('SNR(dB)');xlabel('20logD (Instantaneous value/peak value)');
grid on
text ('Position',[-35,15],'String', 'linear quantizing n=8');
hold on
B(1)=1/256;
B(2)=1/256;
B(3)=1/64*(1-3/(2*pi)*asin(1/2)); % for improvement factors
B(4)=B(3)*4-1/64*3/(2*pi)*asin(1/4);
B(5)=B(4)*4-1/64*3/(2*pi)*asin(1/8);
B(6)=B(5)*4-1/64*3/(2*pi)*asin(1/16);
B(7)=B(6)*4-1/64*3/(2*pi)*asin(1/32);
B(8)=B(7)*4-1/64*3/(2*pi)*asin(1/64);
n=8;
A=87.6;
for i=1:b
a1=a(i)*(2^11-1);
C=pcmad(8,a1); % 13 line encoding
C1=C(2:4); % take the 2nd and fourth number of the code
S=exdac(3,C1); % for paragraph
s=B(S+1); % for improvement factors with the corresponding paragraph

w=-10*log10(s); % logarithmic of improvement factors


Q(i)=w; % place in Array Q(i)
end
W=6*n+4.77;
SNR21=W+X+Q;
plot(X,SNR21)
text ('Position',[-70,32],'String', 'linear quantizing n=8');
title (‘Sinusoidal input snr features (13 line approximation)’)

Figure 3 is the result of the program running. Through the Figure can be seen that with
the 13 line approximation of Alaw compression feature, SNR curve will appear fluctuations, and
it is no longer the smooth curve, there are 6 troughs, 7peaks in total.

TELKOMNIKA Vol. 11, No. 10, October 2013 : 5973 – 5979


TELKOMNIKA e-ISSN: 2087-278X  5979

13 Line quantization: n=8

linear quantizing:
n=8

20logD (peaks)

Figure 3. Sinusoidal input SNR features (13 line approximation).

4. Conclusion
PCM has been as the key technology in the modern digital communications, which
occupies an important position in the communication engineering. In this paper PCM system
simulation was established based on the Matlab and comparative analysis on the performance
of the linear PCM and logarithmic PCM, and the given specific examples can provide reference
for other communication system simulation analysis.

References
[1] Zhigang Cao, Yasheng Qian. Modern Communication Principles. Beijing: tsinghua university press.
1992.
[2] Huaicheng Cheng, Dazheng Wu, Gaixi Quan. MATLAB and Its Application in Electronic and
Information Courses. Beijing: Electronic Industry Press. 2002.
[3] Lijun Zheng,Qiheng Ying,Weili Yang. Signals and Systems (second edition). Beijing: Higher Education
Press. 2000.
[4] Hua Deng. MATLAB Simulation and Communication Application Example Explanation. Beijing:
People's Posts and Telecommunications Press. 2003.
[5] Hong Liang, Yuanyuan Pu, Jieliang. Signal and linear System Analysis: Method Based on MATLAB
and Implementation. Beijing: Higher Education Press. 2006.
[6] Liang Jia-Hai, Jin Yong-Chao, Jia Jin-Ning. Research of Modeling and Simulation of Shrimp Farming
Process Based on Agent. Journal of yunnan agricultural university: natural science edition. 2011;
26(6): 866-871.

MATLAB Based PCM Modeling and Simulation (Hong Liang)

You might also like