Sinyal/Citra/Video Digital, Penyembunyian Data, Steganografi, Steganalisis, dan Forensika Multimedia
Dr.Eng Rismon Hasiholan Sianipar, S.T., M.T., M.Eng
Praktiksi, Programer, dan Kriptolog
Saturday, September 2, 2017
UPDATE: JENDELA BLACKMAN UNTUK MENAPIS RUNTUN DISKRET DAN SINYAL AUDIO
Kode sumber callback GUI MATLAB:
function Lowpass_Callback(hObject, eventdata, handles)
% hObject handle to Lowpass (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 parameter tapis
omega1s = str2num(get(handles.omega1s,'String'));
omega2s = str2num(get(handles.omega2s,'String'));
omega1p = str2num(get(handles.omega1p,'String'));
omega2p = str2num(get(handles.omega2p,'String'));
A1s = str2num(get(handles.A1s,'String'));
A2s = str2num(get(handles.A2s,'String'));
R1p = str2num(get(handles.R1p,'String'));
R2p = str2num(get(handles.R2p,'String'));
%Mengalikan dengan pi
omega1s = omega1s * pi;
omega1p = omega1p * pi;
omega2s = omega2s * pi;
omega2p = omega2p * pi;
if(omega1s > omega1p)
%Menghitung frek cut-ff dan lebar pita
tr_lebar=omega1s-omega1p;
M=ceil(11*pi/tr_lebar)+1
n=[0:1:M-1];
wc=(omega1s+omega1p)/2; %frekuensi cut-off ideal
%Tanggapan tapis ideal
hd=lp_ideal(wc,M);
%Tanggapan tapis aktual
w_bla=(blackman(M))';
h=hd.*w_bla;
%Tanggapan frekuensi
[db,mag,pha,grd,w]=freqz_m(h,[1]);
delta_w=2*pi/1000;
%Menghitung riak dan atenuasi
Rp=(min(db(1:1:omega1p/delta_w+1))) % riak passband aktual
As=round(max(db(omega1s/delta_w+1:1:501))) % attenuasi stopband minimum
%Menampilkan tanggapan impuls ideal
axes(handles.axes7);
bar(n,hd, 'BarWidth', 2);
g = findobj(gca,'Type','patch'); title('Respon impuls ideal');
set(g,'FaceColor','r','EdgeColor','y');
axis([0 M-1 min(hd) max(hd)+0.01]);xlabel('n'); ylabel('hd(n)');
set(gca,'color',[0,0.75,0.75]);
grid on
set(gca, 'XColor', 'r')
set(gca, 'YColor', 'r')
%Menampilkan jendela Blackman
axes(handles.axes8);
bar(n,w_bla, 'BarWidth', 2);
title('Jendela Blackman');
g = findobj(gca,'Type','patch');
set(g,'FaceColor','r','EdgeColor','y');
axis([0 M-1 0 1.1]);xlabel('n'); ylabel('wn');
set(gca,'color',[0,0.75,0.75]);
grid on
set(gca, 'XColor', 'r')
set(gca, 'YColor', 'r')
%Menampilkan tanggapan impuls aktual
axes(handles.axes9);
bar(n,h, 'BarWidth', 2);
g = findobj(gca,'Type','patch');
set(g,'FaceColor','r','EdgeColor','y');
title('Respon impuls aktual');
axis([0 M-1 min(h) max(h)+0.01]);xlabel('n'); ylabel('h(n)');
set(gca,'color',[0,0.75,0.75]);
grid on
set(gca, 'XColor', 'r')
set(gca, 'YColor', 'r')
%Menampilkan tanggapan dalam dB
axes(handles.axes3);
plot(w/pi,db,'color','r', 'LineWidth' ,2.5);title('Respon magnitudo dalam dB'); grid on;
axis([0 1 -100 10]);xlabel('frekuensi dalam unit pi'); ylabel('dB');
set(gca,'color',[0,0.75,0.75]);
grid on
set(gca, 'XColor', 'r')
set(gca, 'YColor', 'r')
% Menghitung Hasil Penapisan
y = conv(double(x),double(h), 'same');
axes(handles.axes2);
t = 0:length(y)-1; %vektor indeks
bar(t,y, 'BarWidth', 2);
g = findobj(gca,'Type','patch');
set(g,'FaceColor','b','EdgeColor','y');
title('Keluaran Tapis');
axis([0 M-1 min(y) max(y)+0.01]);xlabel('n'); ylabel('h(n)');
set(gca,'color',[0.5,0.75,0]);
grid on
set(gca, 'XColor', 'r')
set(gca, 'YColor', 'r')
else
h = msgbox('Omega1s Harus Lebih Besar dari Omega1p');
end
%Menyimpan data global
global lowpass
lowpass = h;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment