You are on page 1of 9

Yang kode warna merah di ketik di matlab

>> p=[0.1614 0.1394 0.1171 0.1070 0.1342 0.1738 0.4204;0.1394 0.1171 0.1070 0.1342 0.1738
0.4204 0.6863;0.1171 0.1070 0.1342 0.1738 0.4204 0.6896 0.6363]

p=

0.1614 0.1394 0.1171 0.1070 0.1342 0.1738 0.4204


0.1394 0.1171 0.1070 0.1342 0.1738 0.4204 0.6863
0.1171 0.1070 0.1342 0.1738 0.4204 0.6896 0.6363

>> t=[0.1070 0.1342 0.1738 0.4204 0.6896 0.6363 0.3657]

t=

0.1070 0.1342 0.1738 0.4204 0.6896 0.6363 0.3657

>> net=newff(minmax(p),[3,1],{'tansig','purelin'},'traingd')

net =

Neural Network object:

architecture:

numInputs: 1
numLayers: 2
biasConnect: [1; 1]
inputConnect: [1; 0]
layerConnect: [0 0; 1 0]
outputConnect: [0 1]
targetConnect: [0 1]

numOutputs: 1 (read-only)
numTargets: 1 (read-only)
numInputDelays: 0 (read-only)
numLayerDelays: 0 (read-only)

subobject structures:

inputs: {1x1 cell} of inputs


layers: {2x1 cell} of layers
outputs: {1x2 cell} containing 1 output
targets: {1x2 cell} containing 1 target
biases: {2x1 cell} containing 2 biases
inputWeights: {2x1 cell} containing 1 input weight
layerWeights: {2x2 cell} containing 1 layer weight
functions:

adaptFcn: 'trains'
initFcn: 'initlay'
performFcn: 'mse'
trainFcn: 'traingd'

parameters:

adaptParam: .passes
initParam: (none)
performParam: (none)
trainParam: .epochs, .goal, .lr, .max_fail,
.min_grad, .show, .time

weight and bias values:

IW: {2x1 cell} containing 1 input weight matrix


LW: {2x2 cell} containing 1 layer weight matrix
b: {2x1 cell} containing 2 bias vectors

other:

userdata: (user stuff)

>> net.IW{1,1}

ans =

12.8195 -0.2160 -0.6669


-5.1234 4.0340 -4.9357
3.2146 4.2662 5.2020

>> net.b{1}

ans =

-5.0483
1.7169
-2.5927
>> net.LW{2,1}

ans =

-0.1106 0.2309 0.5839

>> net.b{2}

ans =

0.8436

>> [a,Pf,Af,e,Perf]=sim(net,p,[],[],t)

a=

0.7067 0.6595 0.6588 0.7355 1.2543 1.3731 1.2981

Pf =

[]

Af =

[]

e=

-0.5997 -0.5253 -0.4850 -0.3151 -0.5647 -0.7368 -0.9324

Perf =

0.3859

>> net=train(net,p,t)
TRAINGD, Epoch 0/100, MSE 0.385892/0, Gradient 1.57445/1e-010
TRAINGD, Epoch 25/100, MSE 0.096807/0, Gradient 0.644469/1e-010
TRAINGD, Epoch 50/100, MSE 0.0441482/0, Gradient 0.298421/1e-010
TRAINGD, Epoch 75/100, MSE 0.0316245/0, Gradient 0.158707/1e-010
TRAINGD, Epoch 100/100, MSE 0.0276762/0, Gradient 0.0967356/1e-010
TRAINGD, Maximum epoch reached, performance goal was not met.
net =

Neural Network object:

architecture:

numInputs: 1
numLayers: 2
biasConnect: [1; 1]
inputConnect: [1; 0]
layerConnect: [0 0; 1 0]
outputConnect: [0 1]
targetConnect: [0 1]

numOutputs: 1 (read-only)
numTargets: 1 (read-only)
numInputDelays: 0 (read-only)
numLayerDelays: 0 (read-only)

subobject structures:

inputs: {1x1 cell} of inputs


layers: {2x1 cell} of layers
outputs: {1x2 cell} containing 1 output
targets: {1x2 cell} containing 1 target
biases: {2x1 cell} containing 2 biases
inputWeights: {2x1 cell} containing 1 input weight
layerWeights: {2x2 cell} containing 1 layer weight

functions:

adaptFcn: 'trains'
initFcn: 'initlay'
performFcn: 'mse'
trainFcn: 'traingd'

parameters:

adaptParam: .passes
initParam: (none)
performParam: (none)
trainParam: .epochs, .goal, .lr, .max_fail,
.min_grad, .show, .time

weight and bias values:


IW: {2x1 cell} containing 1 input weight matrix
LW: {2x2 cell} containing 1 layer weight matrix
b: {2x1 cell} containing 2 bias vectors

other:

userdata: (user stuff)

>> net.trainParam.epochs=1; Untuk tabel 1 dengan epochs ke 1


>> net.trainParam.show=1;
>> net.trainParam.goal=0.01;
>> [a,Pf,Af,e,Perf]=sim(net,p,[],[],t)

a=

0.2370 0.2064 0.2015 0.2563 0.5452 0.6131 0.7158

Pf =

[]

Af =

[]

e=

-0.1300 -0.0722 -0.0277 0.1641 0.1444 0.0232 -0.3501

Perf =

0.0277
>> net.trainParam.epochs=10000;
>> net.trainParam.show=1000;
>> net.trainParam.goal=0.01;

>> net=train(net,p,t)
TRAINGD, Epoch 0/10000, MSE 0.0130678/0.01, Gradient 0.0279379/1e-010
TRAINGD, Epoch 1467/10000, MSE 0.00999798/0.01, Gradient 0.0232265/1e-010
TRAINGD, Performance goal met.

net =

Neural Network object:

architecture:

numInputs: 1
numLayers: 2
biasConnect: [1; 1]
inputConnect: [1; 0]
layerConnect: [0 0; 1 0]
outputConnect: [0 1]
targetConnect: [0 1]

numOutputs: 1 (read-only)
numTargets: 1 (read-only)
numInputDelays: 0 (read-only)
numLayerDelays: 0 (read-only)

subobject structures:

inputs: {1x1 cell} of inputs


layers: {2x1 cell} of layers
outputs: {1x2 cell} containing 1 output
targets: {1x2 cell} containing 1 target
biases: {2x1 cell} containing 2 biases
inputWeights: {2x1 cell} containing 1 input weight
layerWeights: {2x2 cell} containing 1 layer weight

functions:

adaptFcn: 'trains'
initFcn: 'initlay'
performFcn: 'mse'
trainFcn: 'traingd'
parameters:

adaptParam: .passes
initParam: (none)
performParam: (none)
trainParam: .epochs, .goal, .lr, .max_fail,
.min_grad, .show, .time

weight and bias values:

IW: {2x1 cell} containing 1 input weight matrix


LW: {2x2 cell} containing 1 layer weight matrix
b: {2x1 cell} containing 2 bias vectors

other:

userdata: (user stuff)

>> [a,Pf,Af,e,Perf]=sim(net,p,[],[],t)
Untuk tabel 1 dengan goal tercapai
a=

0.2354 0.1920 0.1893 0.2643 0.5888 0.6177 0.4883

Pf =

[]

Af =

[]

e=

-0.1284 -0.0578 -0.0155 0.1561 0.1008 0.0186 -0.1226

Perf =

0.0100
>> p1=[0.1070 0.1342 0.1738 0.4204 0.1614 0.1394 0.1171;0.1342 0.1738 0.4204 0.6896
0.1394 0.1171 0.1070;0.1738 0.4204 0.6896 0.6363 0.1171 0.1070 0.1342]

p1 =

0.1070 0.1342 0.1738 0.4204 0.1614 0.1394 0.1171


0.1342 0.1738 0.4204 0.6896 0.1394 0.1171 0.1070
0.1738 0.4204 0.6896 0.6363 0.1171 0.1070 0.1342

>> t1=[0.4204 0.6896 0.6363 0.3657 0.1070 0.1342 0.1738]

t1 =

0.4204 0.6896 0.6363 0.3657 0.1070 0.1342 0.1738


Untuk tabel 2
>> [a,Pf,Af,e,Perf]=sim(net,p,[],[],t)

a=

0.2354 0.1920 0.1893 0.2643 0.5888 0.6177 0.4883

Pf =

[]

Af =

[]

e=

-0.1284 -0.0578 -0.0155 0.1561 0.1008 0.0186 -0.1226

Perf =

0.0100

>>

You might also like