⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex626neu.m

📁 其中提到遺傳學的程式碼與應用提供給次淚相向的研究者參考下載
💻 M
字号:
% Main_Program ex626neu.m
% Find a NN to replace the FIS in [P T] described
%   in Example 6.2-6.

% Input pattern
P=[-pi/2 -pi/4;-pi/2 -pi/8;-pi/2 0;-pi/2 pi/8;-pi/2 pi/4; 
   -pi/4 -pi/4;-pi/4 -pi/8;-pi/4 0;-pi/4 pi/8;-pi/4 pi/4;
       0 -pi/4;    0 -pi/8;    0 0;    0 pi/8;    0 pi/4;
    pi/4 -pi/4; pi/4 -pi/8; pi/4 0; pi/4 pi/8; pi/4 pi/4;
    pi/2 -pi/4; pi/2 -pi/8; pi/2 0; pi/2 pi/8; pi/2 pi/4;];
P=P';
% Target
T=[20 20 20 10 0 20 10 10 0 -10 20 10 0 -10 -20 10 0 -10 -10 -20 -10 -10 -20 -20 -20];
% New Feedforward NN
net = newff([-1.58 1.58;-0.8 0.8],[8 1],{'tansig' 'purelin'},'trainlm');
net.trainParam.epochs = 1500;
net.trainParam.goal = 1e-10;
% Training
net = train(net,P,T);
disp('Press <CR> to continue');pause
% Get the Neural output
Y = sim(net,P)
% Reprint the Target
T=[20 20 20 10 0 20 10 10 0 -10 20 10 0 -10 -20 10 0 -10 -10 -20 -10 -10 -20 -20 -20]
% Display weights and bias
W10=net.IW{1,1}
B10=net.b{1}
W20=net.LW{2,1}
B10=net.b{2}
% Plot the target and neural outputs
sample=1:25;
figure(2);plot(sample,T,'o',sample,T,sample,Y)
title('Desired and Neural output plots')
xlabel('Sample points');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -