?? exdyn.m
字號:
%========================================================================% Exdyn: An example for using WaveNet: Dynamic System Identification%========================================================================% By Qinghua Zhang. March, 1994.help exdynecho on% u and y are the input and output of a SISO system, respectively.% % Assumption on the system: y(t) = f(y(t-1), y(t-2), u(t-1)) + noiseload exdyn % Loading the training data {u1,y1} and the test data {u2,y2}% The measured data are ploted in the graphics windowclf; subplot(2,2,1); plot(u1); xlabel('t'); ylabel('u1'); title('Training Data');subplot(2,2,2); plot(u2); xlabel('t'); ylabel('u2'); title('Test Data');subplot(2,2,3); plot(y1); xlabel('t'); ylabel('y1');subplot(2,2,4); plot(y2); xlabel('t'); ylabel('y2');pause% We are going to use a WaveNet to model the system with the model structure:%% y(t) = WaveNet(y(t-1), y(t-2), u(t-1)) + noise.%% You may set the number of wavelets in the network to 10% or choose it on-line with the aid of the FPE criterion.% Call the training procedure%=============================nn = [2 1 1] % Model order: [na, nb, nk]Key = keymenu('Make your choice','Use 10 wavelets','On-line choice');if Key==1 th = wnetarx([y1 u1], nn, 10, 0, 2); % Use 10 wavelets, 0 iterations, initialization mode 2.else th = wnetarx([y1 u1], nn, [], 0, 2); end% Test the result by simulation on the test data set%====================================================zn = wnetsim(th, u2, y2(1:2)); % Simulation with the WaveNet modelclf; plot((401:800)',[y2 zn]); title('Compare y2 and zn'); xlabel('Sample number'); ylabel('y2:- zn:--');pause% Compare to linear ARX model%=============================th0 = wnetarx([y1 u1], [5 4 1], 0); % linear ARX identification, nn=[5 4 1]zl = wnetsim(th0, u2, y2(1:2)); % Simulation with the linear ARX modelclf; subplot(2,1,1); plot((401:800)',[y2 zl])title('Linear ARX'); xlabel('Sample number'); ylabel('y2:- zl:--');subplot(2,1,2); plot((401:800)',[y2 zn])title('WaveNet ARX'); xlabel('Sample number'); ylabel('y2:- zn:--');echo off
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -