?? ex611b.m
字號:
% ex611b.m file.
% System Identification problem for a nonlinear plant
% PenChen Chou, July 28, 2001
% ====== Generate data
Ts=0.001;k1=0:499;k2=500:699;t=Ts*[k1 k2];
u1 = exp(-k1/250).*tan(2*pi*k1/250);
u2 = 0.5*sin(2*pi*k2/250) + 0.5*cos(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)');
% 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)')
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -