• Tidak ada hasil yang ditemukan

BAB V. PENUTUP

5.2. Saran

Untuk penyampurnaan dan pengembangan program simulasi komputer digital graphic equalizer selanjutnya, penilis menyarankan untuk :

1. Tugas akhir ini dapat dilanjutkan lagi dengan mencari kesalahan pemrograman pada proses filtering.

2. Untuk penelitian lebih lanjut dan pengembangan ilmu, dapat juga dikembangkan dengan menambahkan band pass filter agar lebih detail dalam proses filtering. Selain itu, dapat juga dibuat dengan menggunakan IIR (Infinite Impulse Response) filter.

66

[1] Ifeachor, Emmanuel C., dan Barrie W. Jervis, Digital Signal Processing, A Practical Approach – 2nd Ed, Prentice Hall, 2001.

[2] http://adtyan.blogspot.com/2009/12/1.html, diakses 3 November2010. [3] Putra, Agfianto Eko, 2002, Penapis Aktif Elektronika : Teori dan Praktek,

C.V.Gava Media, Yogyakarta.

[4] Petra Christian University Library-/jiunkpe/s1/elkt/2003/jiunkpe-ns-s1-2003-2, diakses 14 November 2009.

[5] Santoso, Tri B., Octavianto, H., Dutono, Titon, Implementasi Filter IIR secara Real Time pada TMS 32C5402, Politeknik Negeri Surabaya. tribudi@eepis-its.edu, diakses 31 Agustus 2009.

[6] Krauss Thomas P., Shure Loren dan Little John N., 1994, Signal Processing Toolbox for use with MATLAB®, The MathWorks.

[7] http://www.Appsig.com/papers.html, diakses 31 Agustus 2009.

[8] Nathanael, Hugo.Y., 2007, “Program Simulasi untuk Realisasi Struktur Tapis Finite Impulse Response”. Skipsi, Jurusan Teknik Elektro Fakultas Sains dan Teknologi Universitas Sanata Dharma.

[9] Ricardo A. Losada, Januari 12,2004 practical FIR filter design in MATLAB: the Math Works.Inc., 3 Apple Hill Dr.Natick, MA 01760,USA.

A

% EQUALIZER, by itself, creates a new EQUALIZER or raises the existing % singleton*.

% H = EQUALIZER returns the handle to a new EQUALIZER or the handle to % the existing singleton*.

% EQUALIZER('CALLBACK',hObject,eventData,handles,...) calls the local

% function named CALLBACK in EQUALIZER.M with the given input arguments. % EQUALIZER('Property','Value',...) creates a new EQUALIZER or raises the % existing singleton*. Starting from the left, property value pairs are

% applied to the GUI before Equalizer_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to Equalizer_OpeningFcn via varargin.

% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)".

% See also: GUIDE, GUIDATA, GUIHANDLES % Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help Equalizer % Last Modified by GUIDE v2.5 18-Nov-2010 16:00:00 % Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @Equalizer_OpeningFcn, ... 'gui_OutputFcn', @Equalizer_OutputFcn, ... 'gui_LayoutFcn', [] , ...

'gui_Callback', []); if nargin && ischar(varargin{1})

gui_State.gui_Callback = str2func(varargin{1}); end

if nargout

[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else

gui_mainfcn(gui_State, varargin{:}); end

% End initialization code - DO NOT EDIT

% --- Executes just before Equalizer is made visible.

function Equalizer_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn.

% hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to Equalizer (see VARARGIN) % Choose default command line output for Equalizer

handles.output = hObject; % Update handles structure guidata(hObject, handles);

% UIWAIT makes Equalizer wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line. function varargout = Equalizer_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT);

% hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output;

% --- Executes on selection change in datain.

function datain_Callback(hObject, eventdata, handles) % hObject handle to datain (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns datain contents as cell array % contents{get(hObject,'Value')} returns selected item from datain % --- Executes during object creation, after setting all properties. function datain_CreateFcn(hObject, eventdata, handles)

% hObject handle to datain (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: listbox controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc

set(hObject,'BackgroundColor','white'); else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end

% --- Executes on button press in gridon.

function gridon_Callback(hObject, eventdata, handles) % hObject handle to gridon (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) grid minor

% --- Executes on button press in move.

function move_Callback(hObject, eventdata, handles) % hObject handle to move (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) pan

% --- Executes on button press in cursor.

function cursor_Callback(hObject, eventdata, handles) % hObject handle to cursor (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) datacursormode;

% --- Executes on button press in zoomin.

function zoomin_Callback(hObject, eventdata, handles) % hObject handle to zoomin (see GCBO)

zoom on

set(handles.move,'enable','on');

% --- Executes on button press in zoomout.

function zoomout_Callback(hObject, eventdata, handles) % hObject handle to zoomout (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) zoom out

pan off

set(handles.move,'enable','off');

% --- function Open_playlist_Callback(hObject, eventdata, handles) % hObject handle to Open_playlist (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Mengambil file playlist

[nama_file, nama_path]=uigetfile({'*.wav','File WAV (*.wav)'},... 'Open File Input');

%baca data masukan if ~isequal(nama_file, 0) handles.data = wavread(fullfile(nama_path,nama_file)); guidata(hObject,handles); else return; end

%tampilkan nama file masukan dan jumlah masukan set(handles.datain,'string',nama_file);

set(handles.Play_Input,'enable','on'); guidata(hObject,handles);

% --- function Save_Callback(hObject, eventdata, handles) % hObject handle to Save (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [file,path] = uiputfile('*.wav','Save file');

if ~isequal(file, 0) wavwrite(handles.data,file); guidata(hObject,handles); else return; end % --- function Exit_Callback(hObject, eventdata, handles) % hObject handle to Exit (see GCBO)

% handles structure with handles and user data (see GUIDATA) keluar=questdlg(['Exit Program?'],['Close Aplication'], 'Yes','No','Yes'); if strcmp(keluar,'No')

return; end

delete(handles.figure1)

% --- function File_Callback(hObject, eventdata, handles) % hObject handle to File (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- function Filtering_Callback(hObject, eventdata, handles) % hObject handle to Filtering (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.Filtering,'enable','on');

set(handles.uipanel4,'visible','on'); datain=get(handles.datain,'string'); datas = handles.data;

z = handles.z; %data yang diambil

nilai_band1=round(get(handles.slider14,'value')); nilai_band2=round(get(handles.slider15,'value')); nilai_band3=round(get(handles.slider16,'value')); nilai_band4=round(get(handles.slider17,'value')); nilai_band5=round(get(handles.slider18,'value')); %pemeriksaan masukan

[datvar] = cekin(datas); %pengecekan data input if datvar==1; handles.nilai_band1 = nilai_band1; handles.nilai_band2 = nilai_band2; handles.nilai_band3 = nilai_band3; handles.nilai_band4 = nilai_band4; handles.nilai_band5 = nilai_band5; %input tetap tw = 400; pr = 0.01; sa = 60; fs = 44000; kebit = 32; inbit = 32; outbit = 32;

%pemrosesan data masukan data = handles.data';

b_atas = handles.data_awal; b_bawah = handles.data_akhir;

%nilai input band 1 fc1 = 500;

fc2 = 4500;

sa1 = sa - handles.nilai_band1; %memanggil fungsi optimal methode hn1 = optimalmethod1(fc1,fc2,tw,pr,sa1,fs); %menampilkan jumlah kofisien filter N1 = length(hn1);

%set(handles.text20,'string',N1);

%jenis struktur tapisyang digunakan transversal structure hs1=hn1;

hnq1=des2bin(hs1,kebit);

[yq1, y1] = transIn(hnq1,x1,outbit); yq1 = yq1;

handles.yq1 = yq1; hns1=hnq1;

%nilai input band 2 fc1_2 = 4500; fc2_2 = 8500;

sa2 = sa - handles.nilai_band2; %memanggil fungsi optimal methode

hn1_2 = optimalmethod2(fc1_2,fc2_2,tw,pr,sa2,fs); %menampilkan jumlah kofisien filter

N2 = length(hn1_2);

%set(handles.text21,'string',N2);

%jenis struktur tapisyang digunakan transversal structure hs1_2=hn1_2;

hnq1_2=des2bin(hs1_2,kebit);

[yq1_2, y1_2] = transIn(hnq1_2,x1,outbit); yq1_2 = yq1_2;

handles.yq1_2 = yq1_2; hns1_2=hnq1_2; %nilai input band 3 fc1_3 = 8500; fc2_3 = 12500;

sa3 = sa - handles.nilai_band3; %memanggil fungsi optimal methode

hn1_3 = optimalmethod3(fc1_3,fc2_3,tw,pr,sa3,fs); %menampilkan jumlah kofisien filter

N3 = length(hn1_3);

%set(handles.text22,'string',N3);

%jenis struktur tapisyang digunakan transversal structure hs1_3=hn1_3;

hnq1_3=des2bin(hs1_3,kebit);

[yq1_3, y1_3] = transIn(hnq1_3,x1,outbit); yq1_3 = yq1_3;

handles.yq1_3 = yq1_3; hns1_3=hnq1_3;

%nilai input band 4 fc1_4 = 12500; fc2_4 = 16500;

sa4 = sa - handles.nilai_band4; %memanggil fungsi optimal methode

hn1_4 = optimalmethod4(fc1_4,fc2_4,tw,pr,sa4,fs); %menampilkan jumlah kofisien filter

N4 = length(hn1_4);

%set(handles.text23,'string',N4);

%jenis struktur tapisyang digunakan transversal structure hs1_4=hn1_4;

hnq1_4=des2bin(hs1_4,kebit);

[yq1_4, y1_4] = transIn(hnq1_4,x1,outbit); yq1_4 = yq1_4;

handles.yq1_4 = yq1_4; hns1_4=hnq1_4; %nilai input band 5 fc1_5 = 16500; fc2_5 = 20500;

sa5 = sa - handles.nilai_band5; %memanggil fungsi optimal methode

hn1_5 = optimalmethod5(fc1_5,fc2_5,tw,pr,sa5,fs); %menampilkan jumlah kofisien filter

N5 = length(hn1_5);

%set(handles.text24,'string',N5);

%jenis struktur tapisyang digunakan transversal structure hs1_5=hn1_5;

hnq1_5=des2bin(hs1_5,kebit);

[yq1_5, y1_5] = transIn(hnq1_5,x1,outbit); yq1_5 = yq1_5;

handles.yq1_5 = yq1_5; hns1_5=hnq1_5;

[amp1_1,f0_1] = freqz(hns1,1,z,fs); mag1_1 = 20*log10(abs(amp1_1)); mag1_1 = mag1_1 - handles.nilai_band1; [amp1_2,f0_2] = freqz(hns1_2,1,z,fs); mag1_2 = 20*log10(abs(amp1_2)); mag1_2 = mag1_2 - handles.nilai_band2; handles.amp1_2 = amp1_2;

[amp1_3,f0_3] = freqz(hns1_3,1,z,fs); mag1_3 = 20*log10(abs(amp1_3)); mag1_3 = mag1_3 - handles.nilai_band3; handles.amp1_3 = amp1_3;

[amp1_4,f0_4] = freqz(hns1_4,1,z,fs); mag1_4 = 20*log10(abs(amp1_4)); mag1_4 = mag1_4 - handles.nilai_band4; handles.amp1_4 = amp1_4;

handles.amp1_5 = amp1_5;

%%menampilkan grafik tanggapan frekuensi dengan 5 bandpass filter %dan menampilkan jumlah koefisien dari masing-masing band pass axes(handles.grafik3) set(handles.text20,'string',N1); set(handles.text21,'string',N2); set(handles.text22,'string',N3); set(handles.text23,'string',N4); set(handles.text24,'string',N5); plot (f0_1,mag1_1,'blue',f0_2,mag1_2,'green',f0_3,mag1_3,'red',f0_4,mag1_4,'cyan',f0_5,mag1_5,'mag enta') xlabel('Frequency(Hz)') ylabel('Magnitude Response (dB)')

legend('filter 1','filter 2','filter 3','filter 4','filter 5','location','northeast'); guidata(hObject,handles);

%meng-non-enable-kan tombol save set(handles.Save,'enable','off'); else return; end %end % --- function Equalizing_Callback(hObject, eventdata, handles) % hObject handle to Equalizing (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- function Optimal_Callback(hObject, eventdata, handles) % hObject handle to Optimal (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) OptimalHelp;

% --- function Program_DGE_Callback(hObject, eventdata, handles) % hObject handle to Program_DGE (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) ProgHelp;

% --- function Pembuat_Callback(hObject, eventdata, handles) % hObject handle to Pembuat (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) pembuatsari

% --- function Help_Callback(hObject, eventdata, handles) % hObject handle to Help (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- % --- Executes when figure1 is resized.

function figure1_ResizeFcn(hObject, eventdata, handles) % hObject handle to figure1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %--- %--- function bineq = des2bin(des,bit)

%des2bin merupakan fungsi untuk mengubah suatu nilai %desimal menjadi biner equivalent sesuai jumlah bit %yang diinginkan.

m = 1;

%mengubah semua nilai desimal menjadi positif d = abs(des);

%mengubah nilai integer menjadi nilai fraksional while fix(d) > 0

d = abs(des)/(10^m); m = m + 1;

end

%menghitung nilai desimal equivalent bineq = 0;

for n = 1 : bit-1

bineq = fix(d*2)/(2^n) + bineq; d = (d*2) - fix(d*2);

end

%mengembalikan tanda(sign)& besar tiap nilai desimal bineq = sign(des) .* bineq * 10^(m-1);

function [yq, y] = transIn(hq,xq,outbit) %transIn merupakan fungsi untuk memasukan %suatu data input ke dalam transversal structure N = length(hq);

m = length(xq);

%hitung panjang keluaran tapis r = N + m - 1;

%perhitungan nilai keluaran tapis y=zeros(1,r);

yq=zeros(1,r);

hbar = waitbar(0,'Please wait...'); for p = 1 : r for k = 1 : N i = p - k + 1; if i <= 0 | i > m a = 0; else a = hq(k)*xq(i); end y(p) = y(p) + a; aq = des2bin(a,outbit); yq(p) = yq(p) + aq; end

close(hbar)

%--- %fungsi untuk band 1 dengan frekuensi cut-off1 = 500 Hz dan %frekuensi cut-off2 = 5000 Hz

%data yang diambil

function hn = optimalmethod1(fc1, fc2, tw, pr, sa1, fs) [ap,as]=konversidB(pr,sa1); f1 = fc1-tw; f2 = fc1; f3 = fc2; f4 = fc2+tw; F = [f1 f2 f3 f4]; M = [0 1 0 ]; dev = [as ap as];

[N,fo,ao,W] = firpmord(F,M,dev,fs); hn = firpm(N,fo,ao,W);

%fungsi untuk band 2 dengan frekuensi cut-off1 = 5000 Hz dan %frekuensi cut-off2 = 9000 Hz

function hn_2 = optimalmethod2(fc1_2, fc2_2, tw, pr, sa2, fs); [ap,as]=konversidB(pr,sa2); f1_2 = fc1_2-tw; f2_2 = fc1_2; f3_2 = fc2_2; f4_2 = fc2_2+tw; F_2 = [f1_2 f2_2 f3_2 f4_2]; M = [0 1 0 ];

dev = [as ap as];

[N_2,fo_2,ao_2,W_2] = firpmord(F_2,M,dev,fs); hn_2 = firpm(N_2,fo_2,ao_2,W_2);

%fungsi untuk band 3 dengan frekuensi cut-off1 = 9000 Hz dan %frekuensi cut-off3 13000 Hz;

function hn_3 = optimalmethod3(fc1_3, fc2_3, tw, pr, sa3, fs); [ap,as]=konversidB(pr,sa3); f1_3 = fc1_3-tw; f2_3 = fc1_3; f3_3 = fc2_3; f4_3 = fc2_3+tw; F_3 = [f1_3 f2_3 f3_3 f4_3]; M = [0 1 0 ];

dev = [as ap as];

[N_3,fo_3,ao_3,W_3] = firpmord(F_3,M,dev,fs); hn_3 = firpm(N_3,fo_3,ao_3,W_3);

%fungsi untuk band 4 dengan frekuensi cut-off1 = 13000 Hz dan %frekuensi cut-off2 = 17000;

[ap,as]=konversidB(pr,sa4); f1_4 = fc1_4-tw; f2_4 = fc1_4; f3_4 = fc2_4; f4_4 = fc2_4+tw; F_4 = [f1_4 f2_4 f3_4 f4_4]; M = [0 1 0 ];

dev = [as ap as];

[N_4,fo_4,ao_4,W_4] = firpmord(F_4,M,dev,fs); hn_4 = firpm(N_4,fo_4,ao_4,W_4);

%fungsi untuk band 5 dengan frekuensi cut-off1 = 17000 Hz dan %frekuensi cut-off2 = 21000;;

function hn_5 = optimalmethod5(fc1_5, fc2_5, tw, pr, sa5, fs); [ap,as]=konversidB(pr,sa5); f1_5 = fc1_5-tw; f2_5 = fc1_5; f3_5 = fc2_5; f4_5 = fc2_5+tw; F_5 = [f1_5 f2_5 f3_5 f4_5]; M = [0 1 0 ];

dev = [as ap as];

[N_5,fo_5,ao_5,W_5] = firpmord(F_5,M,dev,fs); hn_5 = firpm(N_5,fo_5,ao_5,W_5);

function [Ap, As] = konversidB(a,b) Ap =((10^(a/20))-1)/((10^(a/20))+1); As = 10^(b/(-20));

%--- %--- function [datvar] = cekin(datas)

%cek masukkan if datas==0

uiwait(errordlg('Insert name of input file','Not Enough Input...','modal')); datvar=0;

else

datvar=1; end

%--- % --- Executes on slider movement.

function slider14_Callback(hObject, eventdata, handles) % hObject handle to slider14 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'Value') returns position of slider

% get(hObject,'Min') and get(hObject,'Max') to determine range of slider nilai_band1=round(get(handles.slider14,'value'));

if isnan(nilai_band1) | nilai_band1>=44

guidata(hObject,handles);

set(handles.text27,'string',handles.nilai_band1);

% --- Executes during object creation, after setting all properties. function slider14_CreateFcn(hObject, eventdata, handles) % hObject handle to slider14 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background, change % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end

% --- Executes on slider movement.

function slider15_Callback(hObject, eventdata, handles) % hObject handle to slider15 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'Value') returns position of slider

% get(hObject,'Min') and get(hObject,'Max') to determine range of slider nilai_band2=round(get(handles.slider15,'value'));

%if isnan(nilai_band2) | nilai_band2<=0

% errordlg('Anda harus mengisikan nilai pada Band2','Bad Input','modal') %end

handles.nilai_band2 = nilai_band2; guidata(hObject,handles);

set(handles.text28,'string',handles.nilai_band2);

% --- Executes during object creation, after setting all properties. function slider15_CreateFcn(hObject, eventdata, handles) % hObject handle to slider15 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background, change % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end

% --- Executes on slider movement.

% hObject handle to slider16 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'Value') returns position of slider

% get(hObject,'Min') and get(hObject,'Max') to determine range of slider nilai_band3=round(get(handles.slider16,'value'));

%if isnan(nilai_band3) | nilai_band3<=0

% errordlg('Anda harus mengisikan nilai pada Band3','Bad Input','modal') %end

handles.nilai_band3 = nilai_band3; guidata(hObject,handles);

set(handles.text29,'string',handles.nilai_band3);

% --- Executes during object creation, after setting all properties. function slider16_CreateFcn(hObject, eventdata, handles) % hObject handle to slider16 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background, change % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end

% --- Executes on slider movement.

function slider17_Callback(hObject, eventdata, handles) % hObject handle to slider17 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'Value') returns position of slider

% get(hObject,'Min') and get(hObject,'Max') to determine range of slider nilai_band4=round(get(handles.slider17,'value'));

%if isnan(nilai_band4) | nilai_band4<=0

% errordlg('Anda harus mengisikan nilai pada Band4','Bad Input','modal') %end

handles.nilai_band4 = nilai_band4; guidata(hObject,handles);

set(handles.text30,'string',handles.nilai_band4);

% --- Executes during object creation, after setting all properties. function slider17_CreateFcn(hObject, eventdata, handles) % hObject handle to slider17 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background, change

if usewhitebg

set(hObject,'BackgroundColor',[.9 .9 .9]); else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end

% --- Executes on slider movement.

function slider18_Callback(hObject, eventdata, handles) % hObject handle to slider18 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'Value') returns position of slider

% get(hObject,'Min') and get(hObject,'Max') to determine range of slider nilai_band5=round(get(handles.slider18,'value'));

%if isnan(nilai_band5) | nilai_band5<=0

% errordlg('Anda harus mengisikan nilai pada Band5','Bad Input','modal') %end

handles.nilai_band5 = nilai_band5; guidata(hObject,handles);

set(handles.text31,'string',handles.nilai_band5);

% --- Executes during object creation, after setting all properties. function slider18_CreateFcn(hObject, eventdata, handles) % hObject handle to slider18 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background, change % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- function Filter_Output_Callback(hObject, eventdata, handles) % hObject handle to Filter_Output (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %meng-enable-kan frequency domain

set(handles.Filter_Output,'enable','on'); set(handles.uipanel3,'visible','on') yq1 = handles.yq1; yq1_2 = handles.yq1_2; yq1_3 = handles.yq1_3; yq1_4 = handles.yq1_4;

yq1_5 = handles.yq1_5; %yq1>yq1_2&yq1<yq1_2; yq2_1 = length(yq1)-length(yq1_2); yq1_2 = [yq1_2,zeros(1,yq2_1)]; yq3_1 = length(yq1_2)-length(yq1); yq1 = [yq1,zeros(1,yq3_1)]; %yq1>yq1_3&yq1<yq1_3; yq2_2 = length(yq1)-length(yq1_3); yq1_3 = [yq1_3,zeros(1,yq2_2)]; yq3_2 = length(yq1_3)-length(yq1); yq1 = [yq1,zeros(1,yq3_2)]; %yq1>yq1_4&yq1<yq1_4; yq2_3 = length(yq1)-length(yq1_4); yq1_4 = [yq1_4,zeros(1,yq2_3)]; yq3_3 = length(yq1_4)-length(yq1); yq1 = [yq1,zeros(1,yq3_3)]; %yq1>yq1_5&yq1<yq1_5; yq2_4 = length(yq1)-length(yq1_5); yq1_5 = [yq1_5,zeros(1,yq2_4)]; yq3_4 = length(yq1_5)-length(yq1); yq1 = [yq1,zeros(1,yq3_4)]; %yq1_2>yq1_3&yq1_2<yq1_3; yq2_5 = length(yq1_2)-length(yq1_3); yq1_3 = [yq1_3,zeros(1,yq2_5)]; yq3_5 = length(yq1_3)-length(yq1_2); yq1_2 = [yq1_2,zeros(1,yq3_5)]; %yq1_2>yq1_4&yq1_2<yq1_4; yq2_6 = length(yq1_2)-length(yq1_4); yq1_4 = [yq1_4,zeros(1,yq2_6)]; yq3_6 = length(yq1_4)-length(yq1_2); yq1_2 = [yq1_2,zeros(1,yq3_6)]; %yq1_2>yq1_5&yq1_2<yq1_5; yq2_7 = length(yq1_2)-length(yq1_5); yq1_5 = [yq1_5,zeros(1,yq2_7)]; yq3_7 = length(yq1_5)-length(yq1_2); yq1_2 = [yq1_2,zeros(1,yq3_7)]; %yq1_3>yq1_4&yq1_3<yq1_4; yq2_8 = length(yq1_3)-length(yq1_4); yq1_4 = [yq1_4,zeros(1,yq2_8)]; yq3_8 = length(yq1_4)-length(yq1_3); yq1_3 = [yq1_3,zeros(1,yq3_8)]; %yq1_3>yq1_5&yq1_3<yq1_5; yq2_9 = length(yq1_3)-length(yq1_5); yq1_5 = [yq1_5,zeros(1,yq2_9)]; yq3_9 = length(yq1_5)-length(yq1_3); yq1_3 = [yq1_3,zeros(1,yq3_9)]; %yq1_4>yq1_5&yq1_4<yq1_5; yq2_10 = length(yq1_4)-length(yq1_5); yq1_5 = [yq1_5,zeros(1,yq2_10)]; yq3_10 = length(yq1_5)-length(yq1_4); yq1_4 = [yq1_4,zeros(1,yq3_10)]; yn = yq1+yq1_2+yq1_3+yq1_4+yq1_5; yn = [yn]; handles.yn = yn;

set(handles.text19,'string', handles.total_data); %menampilkan jumlah panjang data dari data input

%menampilkan sinyal yang telah difilter dalam domain waktu axes(handles.grafik2)

stem(yn)

xlabel('Line..(n)') ylabel('Amplitude') guidata(hObject,handles); %meng-enable-kan tombol save set(handles.Save,'enable','on');

% --- Executes on button press in Play_Input.

function Play_Input_Callback(hObject, eventdata, handles) % hObject handle to Play_Input (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) datas = handles.data;

%pemeriksaan masukan

[datvar] = cekin(datas); %pengecekan data input if datvar==1;

else return; end

%panjang data

handles.jumlah_data=length(handles.data); %fungsi menghitung panjang data input

set(handles.panjang_data,'string', handles.jumlah_data); %menampilkan jumlah panjang data dari data input

handles.data_awal = 1;

handles.data_akhir = handles.jumlah_data; %menampilkan grafik dalam domain waktu axes(handles.grafik1) plot(handles.data); xlabel('Line..(n)') ylabel('Amplitude') guidata(hObject,handles); wavplay(handles.data)

% --- Executes on button press in Play_Output.

function Play_Output_Callback(hObject, eventdata, handles) % hObject handle to Play_Output (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) yn = handles.yn;

%panjang data

set(handles.text19,'string', handles.jumlah_data2); %menampilkan jumlah panjang data dari data input

handles.data_awal2 = 1;

handles.data_akhir2 = handles.jumlah_data2; %menampilkan grafik domain waktu

axes(handles.grafik2) stem(yn); xlabel('Line..(n)') ylabel('Amplitude') wavplay(yn) guidata(hObject,handles); %meng-enable-kan tombol save set(handles.Save,'enable','on');

% --- Executes on button press in Ubah.

function Ubah_Callback(hObject, eventdata, handles) % hObject handle to Ubah (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %meminta masukan dari pengguna

prompt = {'Data mulai sampel ke: ','sampai sampel ke: '}; title = 'Masukkan Jumlah Sampel Data';

num_lines = 1; a = num2str(handles.jumlah_data); b = handles.jumlah_data; default = {'1',a}; options.Resize='on'; answer = inputdlg(prompt,title,num_lines,default,options); if isempty(answer) return; else

%hitung jumlah data yang baru sampel = answer';

handles.data_awal = str2double(sampel(1)); handles.data_akhir = str2double(sampel(2)); if handles.data_awal < 1 | handles.data_awal > b-1 errordlg('0 < sampel awal < jumlah total sampel',... 'Sampel Salah','modal');

elseif handles.data_akhir < handles.data_awal | handles.data_akhir > b errordlg('data awal < data akhir <= jumlah total sampel',...

'Sampel Salah','modal'); else

jumlah = (handles.data_akhir - handles.data_awal) + 1; %tampilkan jumlah data yang baru

set(handles.panjang_data,'string',jumlah); end end %handles.pjg = get(handles.panjang_data,'string'); z = handles.data_akhir; handles.z = z;

% --- function Reset_Callback(hObject, eventdata, handles) % hObject handle to Reset (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) delete(handles.figure1);

Equalizer;

% --- Executes on button press in pushbutton23.

function pushbutton23_Callback(hObject, eventdata, handles) % hObject handle to pushbutton23 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) legend toggle

% --- Executes on button press in pushbutton24.

function pushbutton24_Callback(hObject, eventdata, handles) % hObject handle to pushbutton24 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) band1

% --- Executes on button press in pushbutton25.

function pushbutton25_Callback(hObject, eventdata, handles) % hObject handle to pushbutton25 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) band2

% --- Executes on button press in pushbutton26.

function pushbutton26_Callback(hObject, eventdata, handles) % hObject handle to pushbutton26 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) band3

% --- Executes on button press in pushbutton27.

function pushbutton27_Callback(hObject, eventdata, handles) % hObject handle to pushbutton27 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) band4

% --- Executes on button press in pushbutton28.

function pushbutton28_Callback(hObject, eventdata, handles) % hObject handle to pushbutton28 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) band5

% --- Executes on button press in pushbutton29.

function pushbutton29_Callback(hObject, eventdata, handles) % hObject handle to pushbutton29 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

Dokumen terkait