LAPORAN RESMI
PRAKTIKUM 2
Pulse Code Modulation
PCM 3 & 4 BIT
PRAKTIKUM TEKNIK PENGKODEAN
Disusun oleh :
Imroatus Sholichah
(1210197004)
2 D4 PJJ TELEKOMUNIKASI
POLITEKNIK ELEKTRONIKA NEGERI
SURABAYA
2021
PCM 3 BIT
%PCM dengan proses quantisasi
%PCM Transmiter
fm=2; %Freq Sinyal
fs=1000*fm; %Freq Sampling
t=0:1/fs:1; %Waktu Periode
t1=0:25/fs:1;
a=3.5; %Amplitudo
x=a*sin(2*pi*fm*t); %Sinyal Sinus (informasi)
x1=a*sin(2*pi*fm*t1);
figure(1);
subplot(211)
plot(t,x,'r-','linewidth',2)
ylabel('Amplitudo')
title('Sinyal informasi')
grid on
subplot(212)
stem(t1,x1,'g')
xlabel('Time')
ylabel('Amplitude')
title('Sinyal Tersampling')
grid on
%Proses Quantisasi (Mid-Tread
enc=[];
for i=1:length(x)
if x(i)>0.5 && x(i)<=1.5
xq(i)=1;
e=[1 0 0];
elseif x(i)>1.5 && x(i)<2.5
xq(i)=2;
e=[1 0 1];
elseif x(i)>2.5 && x(i)<3.5
xq(i)=3;
e=[1 1 0];
elseif x(i)>-3.5 && x(i)<-2.5
xq(i)=-3;
e=[0 0 0];
elseif x(i)>-2.5 && x(i)<-1.5
xq(i)=-2;
e=[0 0 1];
elseif x(i)>-1.5 && x(i)<-0.5
xq(i)=-1;
e=[0 1 0];
elseif x(i)>-0.5 && x(i)<0.5
xq(i)=0;
e=[0 1 1];
end
enc=[enc e];
end
figure(2)
subplot(211)
plot(t,x,'b',t,xq,'m-','linewidth',2)
xlabel('Time')
ylabel('Amplituedo')
title('Sinyal Quantisasi')
grid on
subplot(212)
%figure(3)
plot(t,x-xq,'r-')
xlabel('Amplitudo sample Sinyal Informasi')
ylabel('Error Amlitudo')
title('Error Quantisasi')
grid on
%PCM Reciver
rec=enc; %Recived bits
xq_r=[];
for j=1:3:length(rec)-2
if rec(j)==0 && rec(j+1)==0 && rec(j+2)==0
xql=-3;
elseif rec(j)==0 && rec(j+1)==0 && rec(j+2)==1
xq1=-2;
elseif rec(j)==0 && rec(j+1)==1 && rec(j+2)==0
xq1=-1;
elseif rec(j)==0 && rec(j+1)==1 && rec(j+2)==1
xq1=0;
elseif rec(j)==1 && rec(j+1)==0 && rec(j+2)==0
xq1=1;
elseif rec(j)==1 && rec(j+1)==0 && rec(j+2)==1
xq1=2;
elseif rec(j)==1 && rec(j+1)==1 && rec(j+2)==0
xq1=3;
end
xq_r=[xq_r xq1];
end
figure(4)
plot(t,x,'r',t,xq_r,'g-','linewidth',2)
xlabel('Time')
ylabel('Amplitudo')
title('Sinyal Terdistorsi')
grid on
%Low Pass Filtering
[num den]=butter(5,4*fm/fs); %Butterworth LPF
rec_op=filter(num,den,xq_r); %Smoothing
figure(5)
plot(t,x,'r',t,rec_op,'g','linewidth',2)
xlabel('Time')
ylabel('Amplitudo')
title('Sinyal Hasil Rekonstruksi')
grid on
figure(3)
s=enc(1:2001);d=enc(2002:4002);f=enc(4003:6003);
B=[s' d' f']
subplot(411)
s=enc(1:2001);d=enc(2002:4002);f=enc(4003:6003);
B=[s' d' f']
stairs(B(850:949,:))
%xlabel('Time')
%ylabel('Amplitudo')
title('Sinyal PCM 3 bits')
subplot(412)
stairs(s(1:100),'r')
title('Sinyal PCM bit 1')
subplot(413)
stairs(d(625:724),'b')
%xlabel('Amplitudo')
title('Sinyal PCM bit 2')
subplot(414)
stairs(f(625:724),'m')
xlabel('Time')
title('Sinyal PCM bit 3')
Analisa :
Pada percobaan kali ini dilakukan proses kuantisasi 2^3 dan 2^4, proses yang terjadi dapat dilihat pada
gambar diatas. Sinyal sinyal yang tersampling dan terkuantisasi sesuai dengan masing masing bit yang
digunakan. Pada percobaan pertama dapat dilihan proses kuantisasi dan sampling dari PCM 4 BIT, sedangkan
pada percobaan kedua dapat dilihat proses kuantisasi dan sampling dari PCM 3 BIT.
Kesimpulan :
PCM adalah suatu proses yang mengubah sinyal analog menjadi sinyal digital maupun sebaliknya.
Proses yang dilakukan pada PCM antara lain : proses sampling, quantisasi, coding dan decoding.