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

📄 ex611.m

📁 其中提到遺傳學的程式碼與應用提供給次淚相向的研究者參考下載
💻 M
字号:
% ex611.m file.
% System Identification problem for a nonlinear plant
% PenChen Chou, July 28, 2001

% ====== Generate training data
Ts=0.001;k1=0:499;k2=500:699;t=Ts*[k1 k2];
u1 = sin(2*pi*k1/250);
u2 = 0.5*sin(2*pi*k2/250) + 0.5*sin(2*pi*k2/25);
u=[u1 u2];
f = 0.6*sin(pi*u) + 0.3*sin(3*pi*u) +  0.1*sin(5*pi*u);
figure(1);subplot(221);plot(t,u)
title('Input waveform (u)');
% New NN
net = newff([-1 1],[10 1],{'tansig' 'purelin'});
net.trainParam.epochs = 5000;
% Training
net = train(net,u,f);
% Get the Neural output
v = sim(net,u);
figure(1);subplot(222);plot(t,f,t,v)
title('Target and NN output waveforms (f,v)');
figure(1);subplot(223);plot(t,f-v)
title('Error waveform (f-v)');
% Get the true output 
ykm1=0; yk=0;
for I=1:length(t)-1
    y(I+1)=0.3*yk+0.6*ykm1+f(I);
    ykm1=yk; yk=y(I+1); 
end;
% Get the NN system output 
ykm1=0; yk=0;
for I=1:length(t)-1
    yn(I+1)=0.3*yk+0.6*ykm1+v(I);
    ykm1=yk; yk=yn(I+1); 
end;
figure(1);subplot(224);plot(t,y,t,yn)
title('System true and NN output waveforms (y and yn)');
xlabel('Time(s)')

⌨️ 快捷键说明

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