📄 testnn.m
字号:
function testnn()% Min/Max values for each inputPR = [0 1; 0 1];% Size of hidden/output layerS = [5 1];% Cols - Input vectors, each col diff. vectorTI = [0 0 1 1; 0 1 0 1];% Cols - Target output for each vector TO = [-.9 .9 .9 -.9];% Unit type for hidden and output layersT = {'tansig' 'tansig'};% Create neural netnet = newff(PR,S,T,'traingdm');% Simulate and plotY1 = sim(net, TI);subplot(1,3,1);plot([1 2 3 4], Y1);% Set number of training epochs and errorsubplot(1,3,2);net.trainParam.epochs = 500;net.trainParam.goal = 0.001;% Train[net, tr] = train(net, TI, TO);%tr.perf % - trace of performance error [epochs+1]% Simulate and plotY1 = sim(net, TI);subplot(1,3,3);plot([1 2 3 4], Y1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -