• Tidak ada hasil yang ditemukan

LAMPIRAN LISTING PROGRAM Prototype.m

N/A
N/A
Protected

Academic year: 2019

Membagikan "LAMPIRAN LISTING PROGRAM Prototype.m"

Copied!
26
0
0

Teks penuh

(1)

LAMPIRAN LISTING PROGRAM

Prototype.m

function varargout = prototype(varargin) gui_Singleton = 1;

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

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @prototype_OpeningFcn, ...

'gui_OutputFcn', @prototype_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

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

function prototype_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject;

guidata(hObject, handles);

% --- Outputs from this function are returned to the command line.

function varargout = prototype_OutputFcn(hObject, eventdata, handles) varargout{1} = handles.output;

%

-function utama_Callback(hObject, eventdata, handles)

%

-function pelatihan_Callback(hObject, eventdata, handles)

%

-function pengujian_Callback(hObject, eventdata, handles)

%

(2)

%

-function keluar_Callback(hObject, eventdata, handles)

choice= questdlg ('apakah Anda yakin ingin keluar?','confirm',...

'Yes','No','No'); switch choice case'Yes'

close all; end

%

-function ujibackpropagation_Callback(hObject, eventdata, handles) ujibackpropagation

close prototype;

%

-function ujiperceptron_Callback(hObject, eventdata, handles) ujiperceptron

close prototype;

%

-function metodebackpropagation_Callback(hObject, eventdata, handles) metodebackpropagation

close prototype;

%

-function metodeperceptron_Callback(hObject, eventdata, handles) metodeperceptron

close prototype;

metodebackpropagation.m

function varargout = metodebackpropagation(varargin)

gui_Singleton = 1;

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

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @metodebackpropagation_OpeningFcn, ...

'gui_OutputFcn', @metodebackpropagation_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

(3)

function metodebackpropagation_OpeningFcn(hObject, eventdata, handles, varargin)

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

function varargout = metodebackpropagation_OutputFcn(hObject, eventdata, handles, varargin)

varargout{1} = handles.output;

%

-function utama_Callback(hObject, eventdata, handles) metodebackpropagation

% ---\

function uji_jst_Callback(hObject, eventdata, handles) ujibackpropagation

close metodebackpropagation;

%

-function bantuan_Callback(hObject, eventdata, handles) bantuanpelatihan

%

-function keluar_Callback(hObject, eventdata, handles)

%

-function menuutama_Callback(hObject, eventdata, handles) prototype

close metodebackpropagation;

function edit1_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit1_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

% --- Executes on button press in cari.

function cari_Callback(hObject, eventdata, handles)

[nama_file,nama_path] = uigetfile({'*.jpg','File jpeg (*.jpg)'},'Buka File Citra');

if ~isequal(nama_file,0)

handles.citra=imread(fullfile(nama_path,nama_file)); guidata(hObject,handles);

axes(handles.axes1); imshow(handles.citra); axes(handles.axes1); imshow(handles.citra); else

(4)

% --- Executes on button press in cari2.

function cari2_Callback(hObject, eventdata, handles)

[nama_file,nama_path] = uigetfile({'*.jpg','File jpeg (*.jpg)'},'Buka File Citra');

if ~isequal(nama_file,0)

handles.citra2=imread(fullfile(nama_path,nama_file)); guidata(hObject,handles);

axes(handles.axes2); imshow(handles.citra); axes(handles.axes2); imshow(handles.citra); else

return; end;

%---function edit3_Callback(hObject, eventdata, handles)

function edit3_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

% --- Executes on slider movement.

function varargout = sd_tres_Callback(hObject, eventdata, handles, varargin)

nilai_red = get(handles.sd_tres,'value'); handles.nilai_red = round(nilai_red); guidata(hObject,handles);

set(handles.edit,'string',handles.nilai_red); citra_gray=rgb2gray(handles.citra);

citra_gray=double(citra_gray); [b k]=size(citra_gray);

for x=1:b for y=1:k

if citra_gray(x,y)<nilai_red

citra_threshold(x,y)=0; elseif citra_gray(x,y)>=nilai_red citra_threshold(x,y)=1; end

end end

citra_threshold

handles.citra_tres=citra_threshold; guidata(hObject,handles);

axes(handles.axes1); imshow(citra_threshold);

% --- Executes during object creation, after setting all properties.

function sd_tres_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'),

get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end

(5)

nilai_red2 = get(handles.sd_tres2,'value'); handles.nilai_red2 = round(nilai_red2); guidata(hObject,handles);

set(handles.edit3,'string',handles.nilai_red2); citra_gray2=rgb2gray(handles.citra2);

citra_gray2=double(citra_gray2); [b k]=size(citra_gray2);

for x=1:b for y=1:k

if citra_gray2(x,y)<nilai_red2

citra_threshold2(x,y)=0; elseif citra_gray2(x,y)>=nilai_red2 citra_threshold2(x,y)=1; end

end end

citra_threshold2

handles.citra_tres2=citra_threshold2; guidata(hObject,handles);

axes(handles.axes2); imshow(citra_threshold2);

function sd_tres2_CreateFcn(hObject, eventdata, handles)

if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end

% --- Executes on button press in reduksidata.

function reduksidata_Callback(hObject, eventdata, handles)

dataawal = xlsread('programbackpropagation.xlsx','datapincode'); prosesdata=mean(dataawal);

[A,B]=size(dataawal);

databaru= dataawal - repmat(prosesdata,A,1); [A,B]=size(databaru);

for x = 1:A for y = 1:B

if databaru(x,y)<=0

databaru(x,y)=0; end

end end

olahdata = 1/B *(databaru*databaru'); [PC,V]= eig(olahdata);

V=diag(V);

[junk,rindices]= sort(-1*V); V=V(rindices);

PC = PC (:,rindices); signal=dataawal'*PC; ext= dataawal*signal; minr=min(ext);

minr=min(minr); maxr=max(ext); maxr=max(maxr); delta=maxr-minr;

datautama=2*(ext-minr)/delta-1;

(6)

xlswrite('programbackpropagation1.xlsx',ext,'datapincode','A2502:T252 1');

xlswrite('programbackpropagation1.xlsx',datautama,'datapincode','A252 3:T2542');

% --- Executes on button press in simpanbackpropagation.

function simpanbackpropagation_Callback(hObject, eventdata, handles) nopin = get(handles.edit1,'string');

a = double(handles.citra_tres); b = double(handles.citra_tres2);

pin = [reshape(a,1,2500); reshape(b,1,2500)]; set(handles.edit1,'string','');

set(handles.edit,'string','0'); set(handles.edit3,'string','0'); axes(handles.axes1);

imshow(1);

axes(handles.axes2); imshow(1);

if(strcmp(nopin,'21A86CC1'))

xlswrite('programbackpropagation.xlsx',pin,'datapincode','A1'); elseif (strcmp(nopin,'21E52EDC'))

xlswrite('programbackpropagation.xlsx',pin,'datapincode','A3'); elseif (strcmp(nopin,'25D6096B'))

xlswrite('programbackpropagation.xlsx',pin,'datapincode','A5'); elseif (strcmp(nopin,'26B5E5C0'))

xlswrite('programbackpropagation.xlsx',pin,'datapincode','A7'); elseif (strcmp(nopin,'27C30B0B'))

xlswrite('programbackpropagation.xlsx',pin,'datapincode','A9'); elseif (strcmp(nopin,'27FBBA4A'))

xlswrite('programbackpropagation.xlsx',pin,'datapincode','A11'); elseif (strcmp(nopin,'29EA3A24'))

xlswrite('programbackpropagation.xlsx',pin,'datapincode','A13'); elseif (strcmp(nopin,'3114AA76'))

xlswrite('programbackpropagation.xlsx',pin,'datapincode','A15'); elseif (strcmp(nopin,'231708D0'))

xlswrite('programbackpropagation.xlsx',pin,'datapincode','A17'); elseif (strcmp(nopin,'2585926A'))

xlswrite('programbackpropagation.xlsx',pin,'datapincode','A19'); else

xlswrite('programbackpropagation.xlsx',pin,'datapincode','A21'); end

% --- Executes on button press in resetbackpropagation.

function resetbackpropagation_Callback(hObject, eventdata, handles) set(handles.edit1,'String','','Enable','on');

set(handles.edit,'String','','Enable','on'); axes(handles.axes1);

imshow(1);

axes(handles.axes2); imshow(2);

% --- Executes during object creation, after setting all properties.

function edit_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

(7)

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

% --- Executes on button press in backpropagation.

function backpropagation_Callback(hObject, eventdata, handles) input =

xlsread('programbackpropagation1.xlsx','datapincode','A2523:T2542'); target = [1 0 0 0 0 0 0 0 0 0;

1 0 0 0 0 0 0 0 0 0; 0 1 0 0 0 0 0 0 0 0; 0 1 0 0 0 0 0 0 0 0; 0 0 1 0 0 0 0 0 0 0; 0 0 1 0 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0; 0 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 1; 0 0 0 0 0 0 0 0 0 1];

target = target'; input=input';

net = newff(minmax(input),[20 20 10], {'tansig','tansig','tansig'},'traingda'); net.trainParam.show=100;

net.trainParam.epochs=20000; net.trainParam.goal=0.0001; net.trainParam.lr = 0.1; net.trainParam.mc = 0.1;

[net,tr] = train(net,input,target);

xlswrite('programbackpropagation2.xlsx',net.IW{1,1},'bobot','A'); xlswrite('programbackpropagation3.xlsx',net.LW{2,1},'bobot','A'); xlswrite('programbackpropagation4.xlsx',net.LW{3,2},'bobot','A'); xlswrite('programbackpropagation5.xlsx',net.b{1},'bias','A1:A20'); xlswrite('programbackpropagation5.xlsx',net.b{2},'bias','B1:B20'); xlswrite('programbackpropagation5.xlsx',net.b{3},'bias','C1:C10'); output = sim(net,input)

metodeperceptron.m

function varargout = metodeperceptron(varargin) gui_Singleton = 1;

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

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @metodeperceptron_OpeningFcn, ...

'gui_OutputFcn', @metodeperceptron_OutputFcn, ...

'gui_LayoutFcn', [] , ...

'gui_Callback', []);

(8)

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

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

function metodeperceptron_OpeningFcn(hObject, eventdata, handles, varargin)

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

% --- Outputs from this function are returned to the command line.

function varargout = metodeperceptron_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

function edit1_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit1_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

%

-function utama_Callback(hObject, eventdata, handles) metodeperceptron

%

-function bantuan_Callback(hObject, eventdata, handles) bantuanpelatihan

%

-function keluar_Callback(hObject, eventdata, handles) close metodeperceptron;

%

-function uji_jst_Callback(hObject, eventdata, handles) ujiperceptron

close metodeperceptron;

% --- Executes on button press in cari.

function cari_Callback(hObject, eventdata, handles)

[nama_file,nama_path] = uigetfile({'*.jpg','File jpeg (*.jpg)'},'Buka File Citra');

if ~isequal(nama_file,0)

handles.citra=imread(fullfile(nama_path,nama_file)); guidata(hObject,handles);

(9)

imshow(handles.citra); axes(handles.axes1); imshow(handles.citra); else

return; end;

% --- Executes on button press in cari.

function cari2_Callback(hObject, eventdata, handles)

[nama_file,nama_path] = uigetfile({'*.jpg','File jpeg (*.jpg)'},'Buka File Citra');

if ~isequal(nama_file,0)

handles.citra2=imread(fullfile(nama_path,nama_file)); guidata(hObject,handles);

axes(handles.axes2); imshow(handles.citra2); axes(handles.axes2); imshow(handles.citra2); else

return; end;

% --- Executes on slider movement.

function varargout = sd_tres_Callback(hObject, eventdata, handles, varargin)

nilai_red = get(handles.sd_tres,'value'); handles.nilai_red = round(nilai_red); guidata(hObject,handles);

set(handles.edit1,'string',handles.nilai_red); citra_gray=rgb2gray(handles.citra);

citra_gray=double(citra_gray); [b k]=size(citra_gray);

for x=1:b for y=1:k

if citra_gray(x,y)<nilai_red

citra_threshold(x,y)=0; elseif citra_gray(x,y)>=nilai_red citra_threshold(x,y)=1; end

end end

citra_threshold

handles.citra_tres=citra_threshold; guidata(hObject,handles);

axes(handles.axes1); imshow(citra_threshold);

% --- Executes on slider movement.

function sd_tres2_Callback(hObject, eventdata, handles) nilai_red2 = get(handles.sd_tres2,'value');

handles.nilai_red2 = round(nilai_red2); guidata(hObject,handles);

set(handles.edit2,'string',handles.nilai_red2); citra_gray2=rgb2gray(handles.citra2);

citra_gray2=double(citra_gray2); [b k]=size(citra_gray2);

for x=1:b for y=1:k

(10)

citra_threshold2(x,y)=0; elseif citra_gray2(x,y)>=nilai_red2 citra_threshold2(x,y)=1; end

end end

citra_threshold2

handles.citra_tres2=citra_threshold2; guidata(hObject,handles);

axes(handles.axes2); imshow(citra_threshold2);

function sd_tres2_CreateFcn(hObject, eventdata, handles)

function sd_tres_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'),

get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end

if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end

% --- Executes on button press in simpanperceptron

function simpanperceptron_Callback(hObject, eventdata, handles) nopin = get(handles.edit3,'string');

a = double(handles.citra_tres); b = double(handles.citra_tres2);

pin = [reshape(a,1,2500); reshape(b,1,2500)]; set(handles.edit3,'string','');

set(handles.edit1,'string','0'); set(handles.edit2,'string','0'); axes(handles.axes1);

imshow(1);

axes(handles.axes2); imshow(1);

if(strcmp(nopin,'21A86CC1'))

xlswrite('programperceptron.xlsx',pin,'datapincode','A1'); elseif (strcmp(nopin,'21E52EDC'))

xlswrite('programperceptron.xlsx',pin,'datapincode','A3'); elseif (strcmp(nopin,'25D6096B'))

xlswrite('programperceptron.xlsx',pin,'datapincode','A5'); elseif (strcmp(nopin,'26B5E5C0'))

xlswrite('programperceptron.xlsx',pin,'datapincode','A7'); elseif (strcmp(nopin,'27C30B0B'))

xlswrite('programperceptron.xlsx',pin,'datapincode','A9'); elseif (strcmp(nopin,'27FBBA4A'))

xlswrite('programperceptron.xlsx',pin,'datapincode','A11'); elseif (strcmp(nopin,'29EA3A24'))

xlswrite('programperceptron.xlsx',pin,'datapincode','A13'); elseif (strcmp(nopin,'3114AA76'))

xlswrite('programperceptron.xlsx',pin,'datapincode','A15'); elseif (strcmp(nopin,'231708D0'))

xlswrite('programperceptron.xlsx',pin,'datapincode','A17'); elseif (strcmp(nopin,'2585926A'))

(11)

xlswrite('programperceptron.xlsx',pin,'datapincode','A21'); end

% --- Executes on button press in reduksidata.

function reduksidata_Callback(hObject, eventdata, handles) dataawal = xlsread('programperceptron.xlsx','datapincode'); prosesdata=mean(dataawal);

[A,B]=size(dataawal);

databaru= dataawal - repmat(prosesdata,A,1); [A,B]=size(databaru);

for x = 1:A for y = 1:B

if databaru(x,y)<=0

databaru(x,y)=0; end

end end

olahdata = 1/B *(databaru*databaru'); [PC,V]= eig(olahdata);

V=diag(V);

[junk,rindices]= sort(-1*V); V=V(rindices);

PC = PC(:,rindices); signal=dataawal'*PC; ext= dataawal*signal; minr=min(ext);

minr=min(minr); maxr=max(ext); maxr=max(maxr); delta=maxr-minr;

datautama=2*(ext-minr)/delta-1;

xlswrite('programperceptron1.xlsx',signal,'datapincode','A1:T2500'); xlswrite('programperceptron1.xlsx',ext,'datapincode','A2502:T2521'); xlswrite('programperceptron1.xlsx',datautama,'datapincode','A2523:T25 42');

% --- Executes on button press in reset.

function reset_Callback(hObject, eventdata, handles) set(handles.edit1,'String','','Enable','on');

set(handles.edit2,'String','','Enable','on'); axes(handles.axes1);

imshow(1);

axes(handles.axes2); imshow(2);

% --- Executes on button press in latihjst.

function latihjst_Callback(hObject, eventdata, handles) input =

xlsread('programperceptron1.xlsx','datapincode','A2523:T2542') target = [1 0 0 0 0 0 0 0 0 0;

(12)

0 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 1; 0 0 0 0 0 0 0 0 0 1];

target = target'; input=input';

net = newp(minmax(input),10); net.trainParam.show=1000; net.trainParam.epochs=20000; net.trainParam.goal=0.0001;

%net.adaptParam.passes = 500;

[net,output]= adapt (net,input,target); [net,tr] = train (net,input,target);

xlswrite('programperceptron2.xlsx',net.IW{1,1},'bobot','A'); xlswrite('programperceptron5.xlsx',net.b{1},'bias','A1:A10'); output = sim (net,input)

function edit2_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit2_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

%

-function menuutama_Callback(hObject, eventdata, handles) prototype

close metodeperceptron;

function edit3_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit3_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

ujibackpropagation.m

function varargout = ujibackpropagation(varargin) gui_Singleton = 1;

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

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @ujibackpropagation_OpeningFcn, ...

'gui_OutputFcn', @ujibackpropagation_OutputFcn, ...

(13)

'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

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

function ujibackpropagation_OpeningFcn(hObject, eventdata, handles, varargin)

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

% --- Outputs from this function are returned to the command line.

function varargout = ujibackpropagation_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

%

-function utama_Callback(hObject, eventdata, handles) ujibackpropagation

%

-function bantuan_Callback(hObject, eventdata, handles) bantuanpengujian

%

-function keluar_Callback(hObject, eventdata, handles)

%

-function menuutama_Callback(hObject, eventdata, handles) prototype

%

-function edit1_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit1_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

% --- Executes on button press in cari.

function cari_Callback(hObject, eventdata, handles)

[fileName, pathName] = uigetfile({'*.jpg','File jpeg (*.jpg)'}, 'Open Bitmap File');

if isequal(fileName, 0) return;

else

(14)

filename = info.Filename;

handles.citra = imread(fullfile(pathName, fileName)); guidata(hObject, handles);

axes(handles.axes1); imshow(handles.citra);

set(handles.edit3, 'string', fileName); end;

function edit2_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit2_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

% --- Executes on slider movement.

function slider1_Callback(hObject, eventdata, handles) nilai_red = get(handles.slider1,'value');

handles.nilai_red = round(nilai_red); guidata(hObject,handles);

set(handles.edit1,'string',handles.nilai_red); citra_gray=rgb2gray(handles.citra);

citra_gray=double(citra_gray); [b k]=size(citra_gray);

for x=1:b for y=1:k

if citra_gray(x,y)<nilai_red

citra_threshold(x,y)=0; elseif citra_gray(x,y)>=nilai_red citra_threshold(x,y)=1; end

end end

citra_threshold

handles.citra_tes=citra_threshold; guidata(hObject,handles)

axes(handles.axes1); imshow(citra_threshold);

% --- Executes during object creation, after setting all properties.

function slider1_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'),

get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end

% --- Executes on button press in reset.

function reset_Callback(hObject, eventdata, handles) set(handles.edit1,'String','','Enable','on');

set(handles.edit2,'String','','Enable','on'); axes(handles.axes1);

imshow(1);

% --- Executes on button press in ujipengenalan.

(15)

tStart=tic; Signal =

xlsread('programbackpropagation1.xlsx','datapincode','A1:T2500'); ext =

xlsread('programbackpropagation1.xlsx','datapincode','A2502:T2521'); input =

xlsread('programbackpropagation1.xlsx','datapincode','A2523:T2542'); citrauji = double(handles.citra_tes);

flatvec = [reshape(citrauji,1,2500)]; mat_uji = flatvec*Signal;

minr=min(ext); minr=min(minr); maxr=max(ext); maxr=max(maxr); delta=maxr-minr;

datapengujian = 2 *(mat_uji-minr)/delta-1;

target =[ 1 0 0 0 0 0 0 0 0 0; 1 0 0 0 0 0 0 0 0 0; 0 1 0 0 0 0 0 0 0 0; 0 1 0 0 0 0 0 0 0 0; 0 0 1 0 0 0 0 0 0 0; 0 0 1 0 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0; 0 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 1; 0 0 0 0 0 0 0 0 0 1];

target = target'; input = input';

net = newff(minmax(input),[20 20 10], {'tansig','tansig','tansig'},'traingdx'); net = init(net);

net.IW{1,1}= xlsread('programbackpropagation2.xlsx','bobot'); net.LW{2,1}= xlsread('programbackpropagation3.xlsx','bobot'); net.LW{3,2}= xlsread('programbackpropagation4.xlsx','bobot'); net.b{1}= xlsread('programbackpropagation5.xlsx','bias','A1:A20'); net.b{2}= xlsread('programbackpropagation5.xlsx','bias','B1:B20'); net.b{3}= xlsread('programbackpropagation5.xlsx','bias','C1:C10'); datapengujian=datapengujian'

output = sim(net,datapengujian)

if (output(1,1)<0.9) a(1,1)=0;

else

a(1,1)=1; end

(16)

else

a(2,1)=1; end

if (output(3,1)<0.9) a(3,1)=0;

else

a(3,1)=1; end

if (output(4,1)<0.9) a(4,1)=0;

else

a(4,1)=1; end

if (output(5,1)<0.9) a(5,1)=0;

else

a(5,1)=1; end

if (output(6,1)<0.9) a(6,1)=0;

else

a(6,1)=1; end

if (output(7,1)<0.9) a(7,1)=0;

else

a(7,1)=1; end

if (output(8,1)<0.9) a(8,1)=0;

else

a(8,1)=1; end

if (output(9,1)<0.9) a(9,1)=0;

else

a(9,1)=1; end

if (output(10,1)<0.9) a(10,1)=0;

else

a(10,1)=1; end

pin=[a(1,1);a(2,1);a(3,1);a(4,1);a(5,1);a(6,1);a(7,1);a(8,1);a(9,1);a (10,1)];

(17)

pin7 = [0; 0; 0; 0; 0; 0; 1; 0; 0; 0;]; pin8 = [0; 0; 0; 0; 0; 0; 0; 1; 0; 0;]; pin9 = [0; 0; 0; 0; 0; 0; 0; 0; 1; 0;]; pin10 = [0; 0; 0; 0; 0; 0; 0; 0; 0; 1;];

if isequal (a,pin1) edit2='21A86CC1'; elseif isequal (a,pin2) edit2='21E52EDC'; elseif isequal (a,pin3) edit2='25D6096B'; elseif isequal (a,pin4) edit2= '26B5E5C0'; elseif isequal (a,pin5) edit2='27C30B0B'; elseif isequal (a,pin6) edit2='27FBBA4A'; elseif isequal (a,pin7) edit2='29EA3A24'; elseif isequal (a,pin8) edit2='3114AA76'; elseif isequal (a,pin9) edit2= '231708D0'; elseif isequal (a,pin10) edit2= '2585926A'; else

edit2='Tidak Dikenali'; end

set(handles.edit2,'String',edit2); waktuuji = toc(tStart);

set(handles.edit4,'string',waktuuji);

function edit3_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit3_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

function edit4_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit4_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

ujiperceptron.m

function varargout = ujiperceptron(varargin) gui_Singleton = 1;

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

(18)

'gui_OpeningFcn', @ujiperceptron_OpeningFcn, ...

'gui_OutputFcn', @ujiperceptron_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

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

function ujiperceptron_OpeningFcn(hObject, eventdata, handles, varargin)

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

% --- Outputs from this function are returned to the command line.

function varargout = ujiperceptron_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

%

---function utama_Callback(hObject, eventdata, handles) ujiperceptron

%

-function bantuan_Callback(hObject, eventdata, handles) bantuanpengujian

%

-function keluar_Callback(hObject, eventdata, handles) close ujiperceptron;

%

-function menuutama_Callback(hObject, eventdata, handles) prototype

close ujiperceptron;

%

---function edit3_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit3_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

% --- Executes on button press in cari.

function varargout = cari_Callback(hObject, eventdata, handles, varargin)

(19)

if isequal(fileName, 0) return;

else

info = imfinfo([pathName, fileName]); filename = info.Filename;

handles.citra = imread(fullfile(pathName, fileName)); guidata(hObject, handles);

axes(handles.axes1); imshow(handles.citra);

set(handles.edit3, 'string', fileName); end;

% --- Executes on slider movement.

function slider1_Callback(hObject, eventdata, handles) nilai_red = get(handles.slider1,'value');

handles.nilai_red = round(nilai_red); guidata(hObject,handles);

set(handles.edit1,'string',handles.nilai_red); citra_gray=rgb2gray(handles.citra);

citra_gray=double(citra_gray); [b k]=size(citra_gray);

for x=1:b for y=1:k

if citra_gray(x,y)<nilai_red

citra_threshold(x,y)=0; elseif citra_gray(x,y)>=nilai_red citra_threshold(x,y)=1; end

end end

citra_threshold

handles.citra_tes=citra_threshold; guidata(hObject,handles)

axes(handles.axes1); imshow(citra_threshold);

% --- Executes during object creation, after setting all properties.

function slider1_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'),

get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end

% --- Executes on button press in reset.

function reset_Callback(hObject, eventdata, handles) set(handles.edit1,'String','','Enable','on');

set(handles.edit2,'String','','Enable','on'); axes(handles.axes1);

imshow(1);

%---function edit1_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit1_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

(20)

%---function edit2_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit2_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

% --- Executes on button press in ujipengenalan.

function ujipengenalan_Callback(hObject, eventdata, handles) tStart=tic;

signal = xlsread('programperceptron1.xlsx','datapincode','A1:T2500'); ext = xlsread('programperceptron1.xlsx','datapincode','A2502:T2521'); input =

xlsread('programperceptron1.xlsx','datapincode','A2523:T2542'); datainput = double (handles.edit2);

citrauji = double(handles.citra_tes); flatvec = [reshape(citrauji,1,2500)]; mat_uji = flatvec*signal;

minr=min(ext); minr=min(minr); maxr=max(ext); maxr=max(maxr); delta=maxr-minr;

datapengujian = 2 *(mat_uji-minr)/delta-1;

target =[ 1 0 0 0 0 0 0 0 0 0; 1 0 0 0 0 0 0 0 0 0; 0 1 0 0 0 0 0 0 0 0; 0 1 0 0 0 0 0 0 0 0; 0 0 1 0 0 0 0 0 0 0; 0 0 1 0 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0; 0 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 1; 0 0 0 0 0 0 0 0 0 1];

target = target'; input = input';

net = newp(minmax(input),10); net = init(net);

net.adaptParam.passes = 500;

[net,output]= adapt (net,input,target);

net.IW{1,1}= xlsread('programperceptron2.xlsx','bobot'); net.b{1}= xlsread('programperceptron5.xlsx','bias','A1:A10'); datapengujian=datapengujian'

(21)

if (output(1,1)<0.6) a(1,1)=0;

else

a(1,1)=1; end

if (output(2,1)<0.6) a(2,1)=0;

else

a(2,1)=1; end

if (output(3,1)<0.6) a(3,1)=0;

else

a(3,1)=1; end

if (output(4,1)<0.6) a(4,1)=0;

else

a(4,1)=1; end

if (output(5,1)<0.9) a(5,1)=0;

else

a(5,1)=1; end

if (output(6,1)<0.9) a(6,1)=0;

else

a(6,1)=1; end

if (output(7,1)<0.9) a(7,1)=0;

else

a(7,1)=1; end

if (output(8,1)<0.9) a(8,1)=0;

else

a(8,1)=1; end

if (output(9,1)<0.9) a(9,1)=0;

else

a(9,1)=1; end

if (output(10,1)<0.9) a(10,1)=0;

else

(22)

pin=[a(1,1);a(2,1);a(3,1);a(4,1);a(5,1);a(6,1);a(7,1);a(8,1);a(9,1);a (10,1)];

pin1 = [1; 0; 0; 0; 0; 0; 0; 0; 0; 0;]; pin2 = [0; 1; 0; 0; 0; 0; 0; 0; 0; 0;]; pin3 = [0; 0; 1; 0; 0; 0; 0; 0; 0; 0;]; pin4 = [0; 0; 0; 1; 0; 0; 0; 0; 0; 0;]; pin5 = [0; 0; 0; 0; 1; 0; 0; 0; 0; 0;]; pin6 = [0; 0; 0; 0; 0; 1; 0; 0; 0; 0;]; pin7 = [0; 0; 0; 0; 0; 0; 1; 0; 0; 0;]; pin8 = [0; 0; 0; 0; 0; 0; 0; 1; 0; 0;]; pin9 = [0; 0; 0; 0; 0; 0; 0; 0; 1; 0;]; pin10 = [0; 0; 0; 0; 0; 0; 0; 0; 0; 1;];

if isequal (a,pin1) edit2='21A86CC1'; elseif isequal (a,pin2) edit2='21E52EDC'; elseif isequal (a,pin3) edit2='25D6096B'; elseif isequal (a,pin4) edit2= '26B5E5C0'; elseif isequal (a,pin5) edit2='27C30B0B'; elseif isequal (a,pin6) edit2='27FBBA4A'; elseif isequal (a,pin7) edit2='29EA3A24'; elseif isequal (a,pin8) edit2='3114AA76'; elseif isequal (a,pin9) edit2= '231708D0'; elseif isequal (a,pin10) edit2= '2585926A'; else

edit2='Tidak Dikenali'; end

set(handles.edit2,'String',edit2); waktuuji = toc(tStart);

set(handles.edit4,'string',waktuuji);

function edit4_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.

function edit4_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

menubantuan.m

function varargout = menubantuan(varargin) gui_Singleton = 1;

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

(23)

'gui_OpeningFcn', @menubantuan_OpeningFcn, ...

'gui_OutputFcn', @menubantuan_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

function menubantuan_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;

guidata(hObject, handles);

function varargout = menubantuan_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

function edit3_Callback(hObject, eventdata, handles)

function edit3_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

%

-function bantuan_Callback(hObject, eventdata, handles) menubantuan

%

-function keluar_Callback(hObject, eventdata, handles) close menubantuan;

bantuanpelatihan.m

function varargout = bantuanpelatihan(varargin) gui_Singleton = 1;

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

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @bantuanpelatihan_OpeningFcn, ...

'gui_OutputFcn', @bantuanpelatihan_OutputFcn, ...

'gui_LayoutFcn', [] , ...

'gui_Callback', []);

if nargin && ischar(varargin{1})

(24)

if nargout

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

gui_mainfcn(gui_State, varargin{:}); end

function bantuanpelatihan_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;

guidata(hObject, handles);

function varargout = bantuanpelatihan_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

function edit3_Callback(hObject, eventdata, handles)

function edit3_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

%

-function bantuanpelatihan_Callback(hObject, eventdata, handles) bantuanpelatihan

%

-function keluar_Callback(hObject, eventdata, handles) close bantuanpelatihan

bantuanpengujian.m

function varargout = bantuanpengujian(varargin) gui_Singleton = 1;

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

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @bantuanpengujian_OpeningFcn, ...

'gui_OutputFcn', @bantuanpengujian_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

(25)

handles.output = hObject;

guidata(hObject, handles);

function varargout = bantuanpengujian_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

function edit3_Callback(hObject, eventdata, handles)

function edit3_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

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

%

-function bantuanpengujian_Callback(hObject, eventdata, handles) bantuanpengujian

%

(26)

CURRICULUM VITAE

Nama

: Ardi Hasiholan

Alamat Sekarang

: Jl. Dr. Mansyur No. 70 Asrama Putera-Medan

Alamat Orang tua

: Jl. Lumbu Timur 1A No. 60 Rawalumbu-Bekasi

Telp/Hp

: 082163779327

Email

Riwayat Pendidikan

2009-2013

: S1 Ilmu Komputer Universitas Sumatera Utara, Medan

2006-2009

: SMA Mahanaim Bekasi

2003-2006

: SMP Negeri 16 Bekasi

1997-2003

: SD Negeri Bojong Rawalumbu XI Bekasi

Keahlian/Kursus yang diikuti

Referensi

Dokumen terkait

function waktu_CreateFcn(hObject, eventdata, handles) if ispc &amp;&amp; isequal(get(hObject,'BackgroundColor'),

function edit3_CreateFcn(hObject, eventdata, handles) if ispc &amp;&amp; isequal(get(hObject,'BackgroundColor'),

% Hint: popupmenu controls usually have a white background on Windows. if ispc &amp;&amp; isequal(get(hObject,'BackgroundColor'),

function varargout = UjiLVQ_OutputFcn(hObject, eventdata, handles) varargout{1} = handles.output;.

function total_CreateFcn(hObject, eventdata, handles) if ispc &amp;&amp; isequal(get(hObject,'BackgroundColor'),

function edit_MSE1_CreateFcn(hObject, eventdata, handles) if ispc &amp;&amp; isequal(get(hObject,'BackgroundColor'),. get(0,'defaultUicontrolBackgroundColor'))

function Untitled_8_Callback(hObject, eventdata, handles) close utama;. function figure1_CreateFcn(hObject,

function deviden_Callback(hObject, eventdata, handles) function deviden_CreateFcn(hObject, eventdata, handles) if ispc &amp;&amp; isequal(get(hObject,'BackgroundColor'),