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

LAMPIRAN

1. Backpropogation
clear;
clc;
data1=[...
1000
6.3
1000
12.5
1000
18.8
1000
25.1
1000
31.3
1000
50.1
1000
56.4
1000
62.7
1000
68.9
1000
75.2
1250
6.3
1250
12.5
1250
18.8
1250
37.6
1250
43.9
1250
50.1
1250
56.4
1250
62.7
1250
68.9
1250
75.2
1500
6.3
1500
12.5
1500
18.8
1500
25.1
1500
43.9
1500
50.1
1500
56.4
1500
62.7
1500
68.9
1500
75.2
1750
6.3
1750
12.5
1750
18.8
1750
37.6
1750
43.9
1750
50.1
1750
56.4
1750
62.7
1750
68.9
1750
75.2
2000
6.3
2000
12.5
2000
18.8
2000
37.6
2000
43.9
2000
50.1
2000
56.4
2000
62.7
2000
68.9
2000
75.2
2250
6.3

0.13
0.14
0.14
0.14
0.15
0.15
0.14
0.14
0.13
0.12
0.2
0.21
0.21
0.22
0.22
0.22
0.22
0.21
0.2
0.19
0.25
0.25
0.26
0.26
0.26
0.26
0.26
0.25
0.25
0.23
0.28
0.28
0.28
0.29
0.29
0.29
0.29
0.28
0.28
0.26
0.3
0.3
0.31
0.31
0.31
0.31
0.31
0.3
0.3
0.28
0.31

2250
2250
2250
2250
2250
2250
2250
2250
2250
2500
2500
2500
2500
2500
2500
2500
2500
2500
2500
2750
2750
2750
2750
2750
2750
2750
2750
2750
2750
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3250
3250
3250
3250
3250
3250
3250
3250
3250
3250
3500
3500
3500
3500
3500
3500
3500
3500
3500
3500

12.5
18.8
37.6
43.9
50.1
56.4
62.7
68.9
75.2
6.3
12.5
18.8
25.1
43.9
50.1
56.4
62.7
68.9
75.2
6.3
12.5
18.8
37.6
43.9
50.1
56.4
62.7
68.9
75.2
6.3
12.5
18.8
25.1
31.3
37.6
43.9
62.7
68.9
75.2
6.3
12.5
18.8
25.1
31.3
37.6
56.4
62.7
68.9
75.2
6.3
12.5
18.8
25.1
43.9
50.1
56.4
62.7
68.9
75.2

0.32
0.32
0.33
0.33
0.33
0.32
0.32
0.31
0.3
0.33
0.33
0.33
0.34
0.34
0.34
0.34
0.33
0.33
0.31
0.34
0.34
0.34
0.35
0.35
0.35
0.34
0.34
0.34
0.32
0.34
0.35
0.35
0.35
0.35
0.35
0.35
0.35
0.34
0.33
0.34
0.35
0.35
0.36
0.36
0.36
0.36
0.36
0.35
0.34
0.34
0.35
0.35
0.36
0.36
0.36
0.36
0.36
0.36
0.35

4000
4000
4000
4000
4000
4000
4000
4000
4000
4000

6.3
12.5
18.8
25.1
43.9
50.1
56.4
62.7
68.9
75.2

0.34
0.35
0.35
0.36
0.36
0.36
0.36
0.36
0.36
0.35];

data2=[...
1000
37.6
0.15
1000
43.9
0.15
1250
25.1
0.22
1250
31.3
0.22
1500
31.3
0.26
1500
37.6
0.26
1750
25.1
0.29
1750
31.3
0.29
2000
25.1
0.31
2000
31.3
0.31
2250
25.1
0.32
2250
31.3
0.33
2500
31.3
0.34
2500
37.6
0.34
2750
25.1
0.34
2750
31.3
0.35
3000
50.1
0.35
3000
56.4
0.35
3250
43.9
0.36
3250
50.1
0.36
3500
31.3
0.36
3500
37.6
0.36
4000
31.3
0.36
4000
37.6
0.36];
P= data1(:,1:2)';
T= data1(:,3)';
net=newff(minmax(P),[6 1],{'tansig' 'purelin'});
net.IW{1,1}=[...
-0.0022
-0.0683
-0.0020
-0.0011
0.0023
0.0041
0.0002
-0.0536
-0.0004
0.0689
0.0011
0.0009];
net.b{1,1}=[...
7.6656
5.1748
-6.1559
-0.1992
-4.4593
0.1947];
net.LW{2,1}=[...
-0.2391 0.1356 -0.8483 -0.8921 0.0616 0.5583];
net.b{2,1}= -0.9626;
Bobot_awal_input=net.IW{1,1};

Bobot_awal_Bias_Input=net.b{1,1};
Bobot_awal_Lapisan=net.LW{2,1};
Bobot_awal_Bias_Lapisan=net.b{2,1};
net.trainParam.epochs = 15;
net = train(net,P,T);
Q=data2(:,1:2)';
TQ=data2(:,3);
Y=sim(net,Q);
Y'
TQ
Error = (((TQ-Y')./TQ*100).^2).^0.5
MSE = mean(Error,1);
Error;
MSE
toc
Bobot_awal_Lapisan'
plot((1:size(Q,2)),TQ,'bo-',(1:size(Q,2)),Y,'r*-');
title('Perbandingan Antara Target (o) dan Output Jaringan (*)');
xlabel('Nomor Data');
ylabel('Nilai Target atau output');
grid;
legend('Target','Output Jaringan');

2. Radial Basis Function


clear;
clc;
data1=[...
1000
6.3
1000
12.5
1000
18.8
1000
25.1
1000
31.3
1000
50.1
1000
56.4
1000
62.7
1000
68.9
1000
75.2
1250
6.3
1250
12.5
1250
18.8
1250
37.6
1250
43.9
1250
50.1
1250
56.4
1250
62.7
1250
68.9
1250
75.2
1500
6.3
1500
12.5
1500
18.8
1500
25.1
1500
43.9
1500
50.1
1500
56.4
1500
62.7
1500
68.9
1500
75.2
1750
6.3
1750
12.5
1750
18.8
1750
37.6
1750
43.9
1750
50.1
1750
56.4
1750
62.7
1750
68.9
1750
75.2
2000
6.3
2000
12.5
2000
18.8
2000
37.6
2000
43.9
2000
50.1
2000
56.4
2000
62.7
2000
68.9
2000
75.2
2250
6.3
2250
12.5
2250
18.8
2250
37.6

0.13
0.14
0.14
0.14
0.15
0.15
0.14
0.14
0.13
0.12
0.2
0.21
0.21
0.22
0.22
0.22
0.22
0.21
0.2
0.19
0.25
0.25
0.26
0.26
0.26
0.26
0.26
0.25
0.25
0.23
0.28
0.28
0.28
0.29
0.29
0.29
0.29
0.28
0.28
0.26
0.3
0.3
0.31
0.31
0.31
0.31
0.31
0.3
0.3
0.28
0.31
0.32
0.32
0.33

2250
2250
2250
2250
2250
2250
2500
2500
2500
2500
2500
2500
2500
2500
2500
2500
2750
2750
2750
2750
2750
2750
2750
2750
2750
2750
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3250
3250
3250
3250
3250
3250
3250
3250
3250
3250
3500
3500
3500
3500
3500
3500
3500
3500
3500
3500
4000
4000
4000

43.9
50.1
56.4
62.7
68.9
75.2
6.3
12.5
18.8
25.1
43.9
50.1
56.4
62.7
68.9
75.2
6.3
12.5
18.8
37.6
43.9
50.1
56.4
62.7
68.9
75.2
6.3
12.5
18.8
25.1
31.3
37.6
43.9
62.7
68.9
75.2
6.3
12.5
18.8
25.1
31.3
37.6
56.4
62.7
68.9
75.2
6.3
12.5
18.8
25.1
43.9
50.1
56.4
62.7
68.9
75.2
6.3
12.5
18.8

0.33
0.33
0.32
0.32
0.31
0.3
0.33
0.33
0.33
0.34
0.34
0.34
0.34
0.33
0.33
0.31
0.34
0.34
0.34
0.35
0.35
0.35
0.34
0.34
0.34
0.32
0.34
0.35
0.35
0.35
0.35
0.35
0.35
0.35
0.34
0.33
0.34
0.35
0.35
0.36
0.36
0.36
0.36
0.36
0.35
0.34
0.34
0.35
0.35
0.36
0.36
0.36
0.36
0.36
0.36
0.35
0.34
0.35
0.35

4000
4000
4000
4000
4000
4000
4000

25.1
43.9
50.1
56.4
62.7
68.9
75.2

data2=[...
1000
37.6
1000
43.9
1250
25.1
1250
31.3
1500
31.3
1500
37.6
1750
25.1
1750
31.3
2000
25.1
2000
31.3
2250
25.1
2250
31.3
2500
31.3
2500
37.6
2750
25.1
2750
31.3
3000
50.1
3000
56.4
3250
43.9
3250
50.1
3500
31.3
3500
37.6
4000
31.3
4000
37.6

0.36
0.36
0.36
0.36
0.36
0.36
0.35];

0.15
0.15
0.22
0.22
0.26
0.26
0.29
0.29
0.31
0.31
0.32
0.33
0.34
0.34
0.34
0.35
0.35
0.35
0.36
0.36
0.36
0.36
0.36
0.36];

P = data1 (:,1:2)';
T = data1 (:,3)';
net = newrbe(P,T,15);
Bobot_input=net.IW{1,1};
Bobot_Bias_Input=net.b{1,1};
Bobot_Lapisan=net.LW{2,1};
Bobot_Bias_Lapisan=net.b{2,1};

Bobot_input

S = sim(net,P);
Q = data2 (:,1:2)';
TQ = data2 (:,3)';
Y = sim(net,Q);
Error = (((TQ'-Y')./TQ'*100).^2).^0.5;
MSE = mean(Error,1);

Bobot_Lapisan'
Error
MSE
Y'
toc

plot((1:size(Q,2)),TQ,'bo-',(1:size(Q,2)),Y,'r*-');
title('Perbandingan Antara Target (o) dan Output Jaringan (*)')
xlabel('Nomor Data')
ylabel ('Nilai Target atau output')
grid;
legend('Target','Output Jaringan');

3. LSSVM RBF Kernel


clc;
data = [...
1000
6.3
1000
12.5
1000
18.8
1000
25.1
1000
31.3
1000
50.1
1000
56.4
1000
62.7
1000
68.9
1000
75.2
1250
6.3
1250
12.5
1250
18.8
1250
37.6
1250
43.9
1250
50.1
1250
56.4
1250
62.7
1250
68.9
1250
75.2
1500
6.3
1500
12.5
1500
18.8
1500
25.1
1500
43.9
1500
50.1
1500
56.4
1500
62.7
1500
68.9
1500
75.2
1750
6.3
1750
12.5
1750
18.8
1750
37.6
1750
43.9
1750
50.1
1750
56.4
1750
62.7
1750
68.9
1750
75.2
2000
6.3
2000
12.5
2000
18.8
2000
37.6
2000
43.9
2000
50.1
2000
56.4
2000
62.7
2000
68.9
2000
75.2
2250
6.3
2250
12.5
2250
18.8

0.13
0.14
0.14
0.14
0.15
0.15
0.14
0.14
0.13
0.12
0.20
0.21
0.21
0.22
0.22
0.22
0.22
0.21
0.20
0.19
0.25
0.25
0.26
0.26
0.26
0.26
0.26
0.25
0.25
0.23
0.28
0.28
0.28
0.29
0.29
0.29
0.29
0.28
0.28
0.26
0.30
0.30
0.31
0.31
0.31
0.31
0.31
0.30
0.30
0.28
0.31
0.32
0.32

2250
2250
2250
2250
2250
2250
2250
2500
2500
2500
2500
2500
2500
2500
2500
2500
2500
2750
2750
2750
2750
2750
2750
2750
2750
2750
2750
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3250
3250
3250
3250
3250
3250
3250
3250
3250
3250
3500
3500
3500
3500
3500
3500
3500
3500
3500
3500
4000
4000

37.6
43.9
50.1
56.4
62.7
68.9
75.2
6.3
12.5
18.8
25.1
43.9
50.1
56.4
62.7
68.9
75.2
6.3
12.5
18.8
37.6
43.9
50.1
56.4
62.7
68.9
75.2
6.3
12.5
18.8
25.1
31.3
37.6
43.9
62.7
68.9
75.2
6.3
12.5
18.8
25.1
31.3
37.6
56.4
62.7
68.9
75.2
6.3
12.5
18.8
25.1
43.9
50.1
56.4
62.7
68.9
75.2
6.3
12.5

0.33
0.33
0.33
0.32
0.32
0.31
0.30
0.33
0.33
0.33
0.34
0.34
0.34
0.34
0.33
0.33
0.31
0.34
0.34
0.34
0.35
0.35
0.35
0.34
0.34
0.34
0.32
0.34
0.35
0.35
0.35
0.35
0.35
0.35
0.35
0.34
0.33
0.34
0.35
0.35
0.36
0.36
0.36
0.36
0.36
0.35
0.34
0.34
0.35
0.35
0.36
0.36
0.36
0.36
0.36
0.36
0.35
0.34
0.35

4000
4000
4000
4000
4000
4000
4000
4000

18.8
25.1
43.9
50.1
56.4
62.7
68.9
75.2

0.35
0.36
0.36
0.36
0.36
0.36
0.36
0.35];

data2 = [...
1000
37.6
1000
43.9
1250
25.1
1250
31.3
1500
31.3
1500
37.6
1750
25.1
1750
31.3
2000
25.1
2000
31.3
2250
25.1
2250
31.3
2500
31.3
2500
37.6
2750
25.1
2750
31.3
3000
50.1
3000
56.4
3250
43.9
3250
50.1
3500
31.3
3500
37.6
4000
31.3
4000
37.6

0.15
0.15
0.22
0.22
0.26
0.26
0.29
0.29
0.31
0.31
0.32
0.33
0.34
0.34
0.34
0.35
0.35
0.35
0.36
0.36
0.36
0.36
0.36
0.36];

X=data(:,1:2);
Y=data(:,3);
gam = 5;
sig2 = 0.4;
type = 'function estimation';
[alpha,b] =
trainlssvm({X,Y,type,gam,sig2,'RBF_kernel','preprocess'});
Xt=data2(:,1:2);
Ytt=data2(:,3);
Yt =
simlssvm({X,Y,type,gam,sig2,'RBF_kernel','preprocess'},{alpha,b},X
t);
%figure;
plotlssvm({X,Y,type,gam,sig2,'RBF_kernel','preprocess'},{alpha,b})
;
hold on;
hold off
%error=((Ytt'-Yt')^2)^0.5
Error = (((Ytt'-Yt')./Ytt'*100).^2).^0.5;

Error'
Ytt
Yt
MSE = mean(Error)
toc
plot(Yt,'r-*');
title('perbandingan efisiensi');
xlabel('jumlah data');
ylabel('efisiensi');
hold on;
plot(Ytt,'b-o');
hold off;
grid
legend('Output','Nilai Target')

You might also like