📄 optrinit.m
字号:
% ------------------------------> OPTRINIT.M <------------------------------
% Initialization file for "opttrain"
% ---------- Switches -----------
simul = 'simulink'; % System specification (simulink/matlab/nnet)
method = 'ff'; % Training algorithm (ff/ct/efra)
refty = 'siggener'; % Reference signal (siggener/<var. name>)
% ------ General Initializations -------
Ts = 0.20; % Sampling period (in seconds)
samples = 200 ; % Number of samples in each epoch
% -- System to be Controlled (SIMULINK) --
integrator= 'ode45'; % Name of dif. eq. solver (f. ex. ode45 or ode15s)
sim_model = 'spm1'; % Name of SIMULINK model
% --- System to be Controlled (MATLAB) --
mat_model = 'springm'; % Name of MATLAB model
model_out = 'smout'; % Output equation (function of the states)
x0 = [0;0]; % Initial states
% ----- Neural Network Specification ------
% The "forward model file" must contain the following variables which together
% define a NNARX-model:
% NN, NetDeff, W1f, W2f
% and the "controller network file" must contain
% NetDefc, W1c, W2c
% (i.e. regressor structure, architecture definition, and weight matrices)
nnforw = 'forward'; % Name of file containing forward model
nnctrl = 'initopt'; % Name of file containing initial controller net
% ------------ Reference filter ---------------
Am = [1]; % Filter denominator
Bm = [1]; % Filter numerator (begins in z^0)
% ------------ Training parameters -----------
maxiter = 7; % Maximum number of epochs
rho = 1e-3; % Penalty on squared differenced controls
% --- Forgetting factor algorithm (ff) ---
% trparms = [lambda p0]
% lambda = forgetting factor (suggested value: 0.995)
% p0 = Covariance matrix diagonal (1-10)
%
% --- Constant trace algorithm (ct) ---
% trparms = [lambda alpha_max alpha_min]
% lambda = forgetting factor (suggested value: 0.995)
% alpha_max = Max. eigenvalue of covariance matrix (100)
% alpha_min = Min. eigenvaule of covariance matrix (0.001)
%
% --- Exponential Forgetting and Restting Algorithm (efra) ---
% trparms = [alpha beta delta lambda]
% Suggested values:
% alpha = 0.5-1
% beta = 0.001
% delta = 0.001
% lambda = 0.98
trparms = [0.995 10];
%trparms = [0.995 100 0.001];
%trparms = [1 0.001 0.001 0.98];
% ------------ Reference signal ------------
% Reference generated by the signal generator
dc = 0; % DC-level
sq_amp = 1; % Amplitude of square signals (row vector)
sq_freq = 0.1; % Frequency of square signals (column vector)
sin_amp = [0]; % Amplitude of sine signals (row vector)
sin_freq= [0]'; % Frequency of sine signals (column vector)
Nvar = 0'; % Variance of white noise signal
% ------- Specify data vectors to plot --------
% Notice that all strings in plot_a and plot_b resp. MUST have the same length
plot_a(1,:) = 'ref_data ';
plot_a(2,:) = 'y_data ';
plot_b(1,:) = 'u_data';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -