Muthia Az-Zahra - Laporan P.Sinyal

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 29

LAPORAN JOB 4

REKAPITULASI FRAME DAN CODING


PENGOLAHAN SINYAL

Nama : Muthia Az – Zahra


Kelas/NIM : 3 EB/061930320520
Mata Kuliah : Pengolahan Sinyal

TEKNIK ELEKTRONIKA
POLITEKNIK NEGERI SRIWIJAYA
TAHUN AJARAN 2020/2021
1. 2D PLOTTING (12 Oktober, 2020)

fcut = 1; //hz subplot(2,1,2)


n = 10; // Filter order [fr, hf] = repfreq(hc1, 0, 15);
hc1 = analpf(n, 'cheb1', [0.1 0], fcut*1* plot(fr, abs(hf), 'b')
%pi); [fr, hf] = repfreq(hc2, 0, 15);
hc2 = analpf(n, 'cheb2', [0 0.1], fcut*2* plot(fr,abs(hf),'g')
%pi); [fr, hf] = repfreq(he, 0, 15);
he = analpf(n, 'ellip', [0.1 0.1], fcut*3*%pi); plot(fr,abs(hf),'r')
hb = analpf(n, 'butt', [0 0], fcut*4*%pi); [fr, hf] = repfreq(hb, 0, 15);
hc1.dt = 'c'; plot(fr, abs(hf), 'c')
hc2.dt = 'c'; legend(["Chebyshev I", "Chebyshev II",
he.dt = 'c'; "Elliptic", "Butterworth"]);
hb.dt = 'c'; xgrid()
t=[0:0.1:2*%pi] xlabel("Frequency (Hz)")
clf(); ylabel("Gain")
subplot(2,1,1) title("Analog filters of order 7")
plot(t,sin(t),'b')
2. ANALOG SIGNAL PLOTTING (19 Oktober, 2020)
t=[0:0.01:1.2]';
xtitle("GRAFIK MUTHIA")
subplot(221)
plot(t,sin(2*x)^3)
subplot(222)
plot(t,2*cos(x^2))
subplot(223)
plot(t,(2*sin(x))^2)
subplot(224)
plot(t,sin(2*x)^3+2*cos(x^2)+(2*sin(x))^2)
3. SINEWAVE (26 Oktober, 2020)
t=[0:0.01:2]; plot(t,0.005*sin((2*%pi*t) + 2/%pi))
xtitle("Grafik MUTHIA.3EB (s(t) = A xlabel("(a)A=2.25,f=1,Φ=2/π")
sin(2πft+Φ)"); subplot(223)
//Figure_1 plot(t,0.005*sin((2*%pi*1.25*t) + 3/%pi))
subplot(221) xlabel("(a)A=2.25,f=1.25,Φ=3/π")
plot(t,0.35*sin((2*%pi*1.5*t) + 1/%pi)) subplot(224)
xlabel("(a)A=0.25,f=1.5,Φ=1/π") plot(t,0.005*sin((2*%pi*1.5*t) + 4/%pi))
subplot(222) xlabel("(a)A=2.25,f=1.5,Φ=4/π")
plot(t,0.35*sin((2*%pi*2.5*t) + 2/%pi))
xlabel("(a)A=0.25,f=2.5,Φ=2/π") t=[0:0.01:2];
subplot(223) xtitle("Grafik MUTHIA.3EB (s(t) = A
plot(t,0.35*sin((2*%pi*3.5*t) + 3/%pi)) sin(2πft+Φ)");
xlabel("(a)A=0.25,f=3.5,Φ=3/π") //Figure_4
subplot(224) subplot(221)
plot(t,0.35*sin((2*%pi*4.5*t) + 4/%pi)) plot(t,0.02*sin((2*%pi*5*t) + 1/%pi))
xlabel("(a)A=0.25,f=4.5,Φ=4/π") xlabel("(a)A=3.25,f=5,Φ=1/π")
subplot(222)
t=[0:0.01:2]; plot(t,0.02*sin((2*%pi*6*t) + 2/%pi))
xtitle("Grafik MUTHIA.3EB (s(t) = A xlabel("(a)A=3.25,f=6,Φ=2/π")
sin(2πft+Φ)"); subplot(223)
//Figure_2 plot(t,0.02*sin((2*%pi*7*t) + 3/%pi))
subplot(221) xlabel("(a)A=3.25,f=7,Φ=3/π")
plot(t,0.05*sin((2*%pi*1.5*t) + 1/%pi)) subplot(224)
xlabel("(a)A=1.25,f=1.5,Φ=1/π") plot(t,0.02*sin((2*%pi*8*t) + 4/%pi))
subplot(222) xlabel("(a)A=3.25,f=8,Φ=4/π")
plot(t,0.05*sin((2*%pi*2*t) + 2/%pi))
xlabel("(a)A=1.25,f=2,Φ=2/π") t=[0:0.01:2];
subplot(223) xtitle("Grafik MUTHIA.3EB (s(t) = A
plot(t,0.05*sin((2*%pi*2.5*t) + 3/%pi)) sin(2πft+Φ)");
xlabel("(a)A=1.25,f=2.5,Φ=3/π") //Figure_5
subplot(224) subplot(221)
plot(t,0.05*sin((2*%pi*3*t) + 4/%pi)) plot(t,4*sin((2*%pi*1.2*t) + 1/%pi))
xlabel("(a)A=1.25,f=3,Φ=4/π") xlabel("(a)A=4.25,f=1.2,Φ=1/π")
subplot(222)
t=[0:0.01:2]; plot(t,4*sin((2*%pi*1.4*t) + 2/%pi))
xtitle("Grafik MUTHIA.3EB (s(t) = A xlabel("(a)A=4.25,f=1.4,Φ=2/π")
sin(2πft+Φ)"); subplot(223)
//Figure_3 plot(t,4*sin((2*%pi*1.6*t) + 3/%pi))
subplot(221) xlabel("(a)A=4.25,f=1.6,Φ=3/π")
plot(t,0.005*sin((2*%pi*0.75*t) + 1/%pi)) subplot(224)
xlabel("(a)A=2.25,f=0.75,Φ=1/π") plot(t,4*sin((2*%pi*1.8*t) + 4/%pi))
subplot(222) xlabel("(a)A=4.25,f=1.8,Φ=4/π")
4. SINEWAVE (2 November, 2020)

t=[0:0.01:2];
subplot(311);
plot(t,1.5*sin(2*%pi*1*t))
subplot(312);
plot(t,0.5*sin(2*%pi*4*t))
subplot(313)
plot(t,1.5*sin(2*%pi*1*t))+(t,0.5*sin(2*%pi*4*t))
5. DOT ANALOG SIGNAL (9 November, 2020)
t5=-0:10; xlabel("Index","fontsize",2,"color","green");
x5=exp(t5); ylabel("Amplitude","fontsize",2,"color","gre
//scf(); en");
subplot(235)
plot(t5,x5,'black','marker','d','markerfac','blac t=[0:0.01:2];
k','markeredg','cyan'); subplot(231);
title('Exponential plot(t,0.5*sin(2*%pi*4*t),'r')
Wave','color','cyan','fontsize',4); xlabel("Time");
xlabel("Index","fontsize",2,"color","cyan"); ylabel("Amplitude");
ylabel("Amplitude","fontsize",2,"color","cya xtitle("Analog Signal");
n");
x6=rand(1,100) t=[0:0.01:2];
//scf(); subplot(234);
subplot(236) plot2d3(t,sin(2*%pi*4*t),'r')
plot(1:length(x6),x6,'black','marker','d','mark xlabel("Time");
erfac','green','markeredg','red'); ylabel("Amplitude");
title('Exponential xtitle("Sampled Signal");
Wave','color','green','fontsize',4);
6. SAMPLE DIGITAL SIGNAL (16 November, 2020)
t=[0:0.01:2]; xlabel("Time");
subplot(421); ylabel("Amplitude");
plot(t,1.5*cos(2*%pi*1*t)) xtitle("Sampled Signal");
xlabel("Time");
ylabel("Amplitude"); t=[0:0.01:2];
xtitle("Continuous Signal"); subplot(426)
plot(t,2.5*sin(2*%pi*2*t))
t=[0:0.01:2]; xlabel("Time");
subplot(423); ylabel("Amplitude");
plot2d3(t,1.5*sin(2*%pi*1*t)) xtitle("Continuous Signal");
xlabel("Time");
ylabel("Amplitude"); t=[0:0.01:2];
xtitle("Sampled Signal"); subplot(428)
plot2d3(t,2.5*sin(2*%pi*2*t))
t=[0:0.01:2]; xlabel("Time");
subplot(422); ylabel("Amplitude");
plot(t,0.5*sin(2*%pi*4*t)) xtitle("Sampled Signal");
xlabel("Time"); t=[0:0.01:2];
ylabel("Amplitude"); subplot(427)
xtitle("Continuous Signal"); plot2d3(t,(1.5*sin(2*%pi*1*t)) + (0.5*sin(2*
%pi*4*t)));
t=[0:0.01:2]; xlabel("Time");
subplot(424); ylabel("Amplitude");
plot2d3(t,0.5*sin(2*%pi*4*t)) xtitle("Sampled Signal");
xlabel("Time");
ylabel("Amplitude"); t=[0:0.01:2];
xtitle("Sampled Signal"); subplot(426)
plot(t,2.5*sin(2*%pi*2*t))
t=[0:0.01:2]; xlabel("Time");
subplot(425) ylabel("Amplitude");
plot(t,(1.5*sin(2*%pi*1*t)) + (0.5*sin(2* xtitle("Continuous Signal");
%pi*4*t)));
xlabel("Time"); t=[0:0.01:2];
ylabel("Amplitude"); subplot(428)
xtitle("Continuous Signal"); plot2d3(t,2.5*sin(2*%pi*2*t))
xlabel("Time");
t=[0:0.01:2]; ylabel("Amplitude");
subplot(427) xtitle("Sampled Signal");
plot2d3(t,(1.5*sin(2*%pi*1*t)) + (0.5*sin(2*
%pi*4*t)));
7. DIGITAL AND ANALOG SIGNAL (23 November, 2020)

t=[0:0.1:2*%pi]'; xtitle("Analog Signal")


subplot(211); xlabel("n");
ylabel("x(n)"); xlabel("n");
plot(x, ylabel("x(n)");
[2*cos(2*t)6*sin(t)5*cos(1/2)*t)9*sin(t)]) plot(x,
subplot(212) [2*cos(2*t)6*sin(t)5*cos(1/2)*t)9*sin(t)
xtitle("Digital Signal")
8. DIGITAL AND ANALOG SIGNAL (30 November, 2020)
t=[0:0.01:2]; subplot(235);
subplot(231); plot2d3(t,2*sin(3*
plot(t,0.5*sin(2*%pi*4*t),'r') %pi*1*t),style=color("green"))
xlabel("Time"); xlabel("Time");
ylabel("Amplitude"); ylabel("Amplitude");
xtitle("Analog Signal"); xtitle("Digital Signal");

t=[0:0.01:2]; t=[0:0.01:2];
subplot(234); subplot(233);
plot2d3(t,0.5*sin(2* plot(t,(0.5*sin(2*%pi*4*t)) + (2*sin(3*
%pi*4*t),style=color("red")) %pi*1*t)));
xlabel("Time"); xlabel("Time");
ylabel("Amplitude"); ylabel("Amplitude");
xtitle("Digital Signal"); xtitle("Analog Signal");

t=[0:0.01:2]; t=[0:0.01:2];
subplot(232); subplot(236);
plot(t,2*sin(3*%pi*1*t),'g') plot2d3(t,(0.5*sin(2*%pi*4*t)) + (2*sin(3*
xlabel("Time"); %pi*1*t)),style=color("blue"));
ylabel("Amplitude"); xlabel("Time");
xtitle("Analog Signal"); ylabel("Amplitude");
xtitle("Analog Signal");
t=[0:0.01:2];
9. DIGITAL AND SIGNAL CONVOLUTION (7 Desember,
2020)
t=[0:0.2:2*%pi]; title('Sequence 2','color','yellow','fontsize',4);
f1=0.5*sin(2*%pi*4*t); xlabel("Index","Fontsize",2,"color","blue",'p
f2=2*sin(3*%pi*1*t) osition',[0.6 0.3]);
y=convol(f1,f2); ylabel("Amplitude","Fontsize",2,"color","bl
subplot(3,1,1); ue");
bar(f1,0.1,'red'); subplot(3,1,3);
title('Sequence 1','color','red','fontsize',4); bar(y,0.1,'green');
xlabel("Index","Fontsize",2,"color","blue",'p title('Convoled
osition',[0.6 0.3]); Sequence','color','green','fontsize',4);
ylabel("Amplitude","Fontsize",2,"color","bl xlabel("Index","Fontsize",2,"color","blue",'p
ue"); osition',[0.6 0.3]);
subplot(3,1,2); ylabel("Amplitude","Fontsize",2,"color","bl
bar(f2,0.1,'yellow'); ue");
10. AUDIO SIGNAL (14 Desember, 2020)

[y,Fs,bits]=wavread("C:\Users\USER\Desktop\Horse");Fs,bits
sound(y,Fs);
subplot(3,1,1)
plot2d(y(1,:))//first channel
z=y(:,$:-1:1);
subplot(3,1,2)
plot2d(z(2,:))//first channel
11. RESERVED AUDIO SIGNAL (21 Desember, 2020)

[y,Fs,bits]=wavread("C:\Users\USER\Desktop\Bass");Fs,bits
sound(y,Fs);
subplot(3,1,1)
plot2d(y(1,:))//first channel
z=y(:,$:-1:1);
subplot(3,1,2)
plot2d(z(2,:))//first channel
12. SHORT TIME ENERGY AUDIO SIGNAL
(28 Desember, 2020)

[y,Fs,bits]=wavread("C:\Users\USER\Deskt En ( j) =0;
op\Bass");Fs,bits if frame_end >= length (y ) then
t =(0:length(y)-1)/Fs; t h e l a s t segmen t
subplot(311) frame_end = length ( y )
plot(t,y) frame_len = frame_end - frame_start ;
xlabel(’Time i n s e c o n d s ’ ) end
title (’ O r i g i n a l s i g n a l ’ ) segment = y ( frame_start : frame_end ) ;
frame_durn = 0.02; for k =1: frame_len
frame_len = Fs * frame_durn ; 34 En ( j) = En ( j ) +( segment ( k ) *
Rect_window = window ( ’ r e ’ , frame_len Rect_window ( k ) ) ^2
); end
frame_shift = Fs * frame_durn /2; frame_start = frame_start + frame_shift ;
R e c t a n g ul a r window frame_end = frame_end + frame_shift ;
no_of_frames = floor ( length ( y ) / end
frame_shift ) ; subplot (312)
frame_start =1; plot ( En )
frame_end = frame_start + frame_len -1; title ( ’ S h o r t Time Enery u s i n g R e c t
for j =1: no_of_frames a n g ul a r window ’ )
xlabel ( ’ Segment number ’ )
ylabel ( ’STE ’ )

13. SHORT TIME ENERGY RESERVED ANIMAL AUDIO


SIGNAL (4 Januari, 2021)

clc; for j=1:no_of_frames


[y,Fs]=wavread("C:\Users\USER\Desktop\H En(j)=0;
orse.wav"); if frame_end>=length(y(1,:))then
t =(0:length(y(1,:))-1)/Fs; frame_end=length(y(1,:))
subplot(311) frame_len=frame_end-frame_start;
plot(t,y) end
xlabel('Time' ) segment=y(1,:)(frame_start:frame_end);
title('Original signal') for k=1:frame_len
frame_durn= 0.02; En(j)=En(j)+
frame_len=Fs*frame_durn; (segment(k)*Rect_window(k))^2;
Rect_window=window('re',frame_len); // Computing the STE
frame_shift=Fs*frame_durn/2; end
no_of_frames=floor(length(y(1,:))/frame_sh frame_start=frame_start+frame_shift;
ift); frame_end=frame_end+frame_shift;
frame_start=1; end
frame_end=frame_start+frame_len-1; subplot (313)
plot(En) ylabel('STE')
title('Short Time Energy Using Rectangular z=y(:,$:-1:1);
Window') subplot(3,1,2)
xlabel('Segment number') plot2d(z(2,:))//first channe

14. ANALOG FILTERS (11 Januari, 2021)

fcut = 1; //hz subplot(2,1,2)


n = 10; // Filter order [fr, hf] = repfreq(hc1, 0, 15);
hc1 = analpf(n, 'cheb1', [0.1 0], fcut*1* plot(fr, abs(hf), 'b')
%pi); [fr, hf] = repfreq(hc2, 0, 15);
hc2 = analpf(n, 'cheb2', [0 0.1], fcut*2* plot(fr,abs(hf),'g')
%pi); [fr, hf] = repfreq(he, 0, 15);
he = analpf(n, 'ellip', [0.1 0.1], fcut*3*%pi); plot(fr,abs(hf),'r')
hb = analpf(n, 'butt', [0 0], fcut*4*%pi); [fr, hf] = repfreq(hb, 0, 15);
hc1.dt = 'c'; plot(fr, abs(hf), 'c')
hc2.dt = 'c'; legend(["Chebyshev I", "Chebyshev II",
he.dt = 'c'; "Elliptic", "Butterworth"]);
hb.dt = 'c'; xgrid()
t=[0:0.1:2*%pi] xlabel("Frequency (Hz)")
clf(); ylabel("Gain")
subplot(2,1,1) title("Analog filters of order 7")
plot(t,sin(t),'b')
15. LOW PASS FILTER (18 Januari, 2021)
fc=100 disp(wtf,'Impulse Response of LPF FIR
fs=25000 Filter: h [n]= ');
M=15 //Plotting Magnitude Response of LPR FIR
w=(%pi/2)*(fc/fs); Filter
disp(w,'Digital cutoff frequency in radians subplot(312)
cycles/sample') plot(fr*fs, wfm)
wc=w/%pi; xlabel('Analog Digital Frequency w -->')
disp(wc,'Normalized digital cutoff frequency ylabel('Magnitude |H(w)|' )
in radians cycles/sample'); title('Magnitude Response of FIR LPF')
[wtf,wfm ,fr]=wfir('lp',M+1,[wc/2,0],'re', xgrid(1)
[0,0]); fc=15
disp(wtf,'Impulse Response of LPF FIR fs=3000
Filter: h [n]= '); M=45
//Plotting Magnitude Response of LPR FIR w=(%pi/2)*(fc/fs);
Filter disp(w,'Digital cutoff frequency in radians
subplot(311) cycles/sample')
plot(fr*fs, wfm) wc=w/%pi;
xlabel('Analog Digital Frequency w -->') disp(wc,'Normalized digital cutoff frequency
ylabel('Magnitude |H(w)|' ) in radians cycles/sample');
title('Magnitude Response of FIR LPF') [wtf,wfm ,fr]=wfir('lp',M+1,[wc/2,0],'re',
xgrid(1) [0,0]);
fc=20 disp(wtf,'Impulse Response of LPF FIR
fs=200 Filter: h [n]= ');
M=10 //Plotting Magnitude Response of LPR FIR
w=(%pi/2)*(fc/fs); Filter
disp(w,'Digital cutoff frequency in radians subplot(313)
cycles/sample') plot(fr*fs, wfm)
wc=w/%pi; xlabel('Analog Digital Frequency w -->')
disp(wc,'Normalized digital cutoff frequency ylabel('Magnitude |H(w)|' )
in radians cycles/sample'); title('Magnitude Response of FIR LPF')
[wtf,wfm ,fr]=wfir('lp',M+1,[wc/2,0],'re', xgrid(
[0,0]);
16. BAND PASS AND BAND STOP FILTER
(25 Januari, 2021)

clc ; wc2 = w2/%pi;


clear ; disp(wc1,'Normalized digital lower cutoff
xdel(winsid()); frequency in cycles/samples');
fc1 = input("Enter Analog lower cutoff disp(wc2,'Normalized digital higher cutoff
freq.in Hz=")//250 frequency in cycles/samples');
fc2 = input("Enter Analog higher cutoff [wft,wfm,fr]=wfir('bp',M+1,
freq.in Hz=")//600 [wc1/2,wc2/2],'re',[0,0]);
fs = input("Enter Analog sampling freq.in disp(wft,'Impulse Response of BPF FIR
Hz=")//2000 Filter:h[n]=');
M = input("Enter order of filter=")//4 subplot(2,1,1)
w1 = (2*%pi)*(fc1/fs); plot(2*fr,wfm)
w2 = (2*%pi)*(fc2/fs); xlabel('Normalized Digital Frequency w−−
disp(w1,'Digital lower cutoff frequency in −>')
radians cycles/samples') ; ylabel('Magnitude|H(w)|=')
disp(w2,'Digital higher cutoff frequency in title('Magnitude Response of FIR BPF ')
radians cycles/samples') ; xgrid(1)
wc1 = w1/%pi; subplot(2,1,2)
plot(fr*fs,wfm) title('Magnitude Response of FIR BPF ')
xlabel('Analog Frequency in Hz f −−−>') xgrid(1)
xlabel('Magnitude|H(w)|= ')

You might also like