Tuesday, February 27, 2018

Tapis FIR Fase Linier Ganjil Untuk Sinyal Audio Digital


Antarmuka GUI MATLAB ini dapat dipakai untuk laboratorium sinyal bagi mahasiswa dan untuk menunjang penelitian bagi para peneliti. Anda bisa memesannya pada form pemesanan di bawah ini.











KODE UNTUK SALAH SATU EVENT CALLBACK:



% --- Executes on button press in Tipe_1.
function Tipe_1_Callback(hObject, eventdata, handles)
% hObject    handle to Tipe_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global x;

% Membaca semua koefisien tapis parallel
h3 = str2num(get(handles.h3,'String'));
h4 = str2num(get(handles.h4,'String'));
h1 = str2num(get(handles.h1,'String'));
h2 = str2num(get(handles.h2,'String'));
h0 = str2num(get(handles.h0,'String'));
h6 = str2num(get(handles.h6,'String'));
h5 = str2num(get(handles.h5,'String'));
h7 = str2num(get(handles.h7,'String'));
h8 = str2num(get(handles.h8,'String'));
h9 = str2num(get(handles.h9,'String'));
h10 = str2num(get(handles.h10,'String'));

h = [h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10];

%Menghitung tipe-1
M = length(h); n = 0:M-1;
[Hr,w,a,L] = Hr_Tipe1(h);

amax = max(a)+1; amin = min(a)-1;
axes(handles.axes7);
stem(n,h,'color','r'); axis([-1 2*L+1 amin amax])
set(gca,'color',[0,0,0]);
xlabel('n'); ylabel('h(n)'); title('Tanggapan Impuls')

axes(handles.axes8);
stem(0:L,a, 'color','r'); axis([-1 2*L+1 amin amax])
xlabel('n'); ylabel('a(n)'); title('koefisien-koefisien a(n)')
set(gca,'color',[0,0,0]);

axes(handles.axes9);
plot(w/pi,Hr,'color','r');grid
xlabel('frekuensi dalam unit pi'); xlabel('Hr')
title('Tanggapan Amplitudo Tipe-1')
set(gca,'color',[0,0,0]);


% Menghitung Hasil Penapisan
y = conv(double(x),double(a), 'same');

axes(handles.axes2); 
t = 0:length(y)-1;  %vektor indeks
stem(t,y,'linewidth',1,'color','y');title('Keluaran Tapis')
set(gca,'color',[0,0,0]);

axes(handles.axes3)
specgram(y, 8, 8);
title('Spektrum Sinyal');
set(gca,'color',[0,0,0]);


% --- Executes on button press in pushbutton18.
function pushbutton18_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton18 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global x;

% Membaca semua koefisien tapis parallel
h3 = str2num(get(handles.h3,'String'));
h4 = str2num(get(handles.h4,'String'));
h1 = str2num(get(handles.h1,'String'));
h2 = str2num(get(handles.h2,'String'));
h0 = str2num(get(handles.h0,'String'));
h6 = str2num(get(handles.h6,'String'));
h5 = str2num(get(handles.h5,'String'));
h7 = str2num(get(handles.h7,'String'));
h8 = str2num(get(handles.h8,'String'));
h9 = str2num(get(handles.h9,'String'));
h10 = str2num(get(handles.h10,'String'));

h = [h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10];

%Menghitung tipe-2
M = length(h); n = 0:M-1;
[Hr,w,a,L] = Hr_Tipe2(h);
length(n),L

amax = max(a)+1; amin = min(a)-1;
axes(handles.axes7);
stem(n,h,'color','r'); axis([-1 2*L+1 amin amax])
set(gca,'color',[0,0,0]);
xlabel('n'); ylabel('h(n)'); title('Tanggapan Impuls')

axes(handles.axes8);
stem(1:L,a, 'color','r'); axis([-1 2*L+1 amin amax])
xlabel('n'); ylabel('a(n)'); title('koefisien-koefisien a(n)')
set(gca,'color',[0,0,0]);

axes(handles.axes9);
plot(w/pi,Hr,'color','r');grid
xlabel('frekuensi dalam unit pi'); xlabel('Hr')
title('Tanggapan Amplitudo Tipe-1')
set(gca,'color',[0,0,0]);

% Menghitung Hasil Penapisan
y = conv(double(x),double(a), 'same');

axes(handles.axes2); 
t = 0:length(y)-1;  %vektor indeks
stem(t,y,'linewidth',1,'color','y');title('Keluaran Tapis')
set(gca,'color',[0,0,0]);

axes(handles.axes3)
specgram(y, 8, 8);
title('Spektrum Sinyal');
set(gca,'color',[0,0,0]);


No comments: