📄 extrid.m
字号:
function [ret,x0,str,ts,xts]=extrid(t,x,u,flag);
%EXTRID is the M-file description of the SIMULINK system named EXTRID.
% The block-diagram can be displayed by typing: EXTRID.
%
% SYS=EXTRID(T,X,U,FLAG) returns depending on FLAG certain
% system values given time point, T, current state vector, X,
% and input vector, U.
% FLAG is used to indicate the type of output to be returned in SYS.
%
% Setting FLAG=1 causes EXTRID to return state derivatives, FLAG=2
% discrete states, FLAG=3 system outputs and FLAG=4 next sample
% time. For more information and other options see SFUNC.
%
% Calling EXTRID with a FLAG of zero:
% [SIZES]=EXTRID([],[],[],0), returns a vector, SIZES, which
% contains the sizes of the state vector and other parameters.
% SIZES(1) number of states
% SIZES(2) number of discrete states
% SIZES(3) number of outputs
% SIZES(4) number of inputs
% SIZES(5) number of roots (currently unsupported)
% SIZES(6) direct feedthrough flag
% SIZES(7) number of sample times
%
% For the definition of other parameters in SIZES, see SFUNC.
% See also, TRIM, LINMOD, LINSIM, EULER, RK23, RK45, ADAMS, GEAR.
% Note: This M-file is only used for saving graphical information;
% after the model is loaded into memory an internal model
% representation is used.
% the system will take on the name of this mfile:
sys = mfilename;
new_system(sys)
simver(1.3)
if (0 == (nargin + nargout))
set_param(sys,'Location',[24,51,502,463])
open_system(sys)
end;
set_param(sys,'algorithm', 'RK-45')
set_param(sys,'Start time', '0.0')
set_param(sys,'Stop time', '999999')
set_param(sys,'Min step size', '0.0001')
set_param(sys,'Max step size', '10')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars', '')
add_block('built-in/Note',[sys,'/','System output-----> '])
set_param([sys,'/','System output-----> '],...
'position',[60,210,65,215])
add_block('built-in/Note',[sys,'/','System input------>'])
set_param([sys,'/','System input------>'],...
'position',[55,190,60,195])
add_block('built-in/Note',[sys,'/','System output----->'])
set_param([sys,'/','System output----->'],...
'position',[65,95,70,100])
add_block('built-in/Note',[sys,'/','System noise------>'])
set_param([sys,'/','System noise------>'],...
'position',[55,230,60,235])
add_block('built-in/Note',[sys,'/','System noise-----> '])
set_param([sys,'/','System noise-----> '],...
'position',[70,120,75,125])
% Subsystem ['Double click',13,'on this block',13,'for a demo.'].
new_system([sys,'/',['Double click',13,'on this block',13,'for a demo.']])
set_param([sys,'/',['Double click',13,'on this block',13,'for a demo.']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this block',13,'for a demo.']],...
'Mask Display','DEMO',...
'Mask Dialogue','eval(''simident'')')
% Finished composite block ['Double click',13,'on this block',13,'for a demo.'].
set_param([sys,'/',['Double click',13,'on this block',13,'for a demo.']],...
'position',[224,216,279,250])
% Subsystem ['General model',13,'estimator using',13,'Predictive Error Method'].
new_system([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']])
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']],'Location',[0,0,371,185])
add_block('built-in/Inport',[sys,'/',['General model',13,'estimator using',13,'Predictive Error Method/input noise']])
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method/input noise']],...
'Port','3',...
'position',[55,140,75,160])
add_block('built-in/Mux',[sys,'/',['General model',13,'estimator using',13,'Predictive Error Method/Mux']])
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method/Mux']],...
'inputs','3',...
'position',[130,82,160,118])
add_block('built-in/Inport',[sys,'/',['General model',13,'estimator using',13,'Predictive Error Method/system output']])
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method/system output']],...
'Port','2',...
'position',[55,90,75,110])
add_block('built-in/S-Function',[sys,'/',['General model',13,'estimator using',13,'Predictive Error Method/S-function',13,'block ']])
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method/S-function',13,'block ']],...
'function name','sfunid',...
'parameters','order,npts,HowOften,offset,ts,method',...
'position',[205,80,260,120])
add_block('built-in/Inport',[sys,'/',['General model',13,'estimator using',13,'Predictive Error Method/system input']])
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method/system input']],...
'position',[55,40,75,60])
add_line([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']],[165,100;200,100])
add_line([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']],[80,100;125,100])
add_line([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']],[80,50;110,50;110,90;125,90])
add_line([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']],[80,150;110,150;110,110;125,110])
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']],...
'Mask Display','PEM',...
'Mask Type','PEM')
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']],...
'Mask Dialogue','General model estimator.\nHook input 1 to system input.\nHook input 2 to system output.|Length of buffer:|Orders of model [na nb nc nd nf nk]:|Calculate after how many points:|Sample time:')
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']],...
'Mask Translate','method = ''pem''; npts=@1; order=@2; HowOften=@3; ts=@4(1); if length(@4) > 1, offset = @4(2), else, offset = 0; end')
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']],...
'Mask Help','Hook the system''s input to the first port of this block and the system''s output to second port. The input noise, which is optional, may be hooked to input 3.\nResults are displayed as the estimated output versus the true output in graphical form. Use signals with high harmonic content for best results. ')
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']],...
'Mask Entries','256\/[3 3 3 3 3 0]\/64\/0.05\/')
% Finished composite block ['General model',13,'estimator using',13,'Predictive Error Method'].
set_param([sys,'/',['General model',13,'estimator using',13,'Predictive Error Method']],...
'Drop Shadow',4,...
'position',[335,297,380,353])
% Subsystem ['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator'].
new_system([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']])
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']],'Location',[0,0,371,185])
add_block('built-in/Inport',[sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator/in_3']])
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator/in_3']],...
'Port','3',...
'position',[55,135,75,155])
add_block('built-in/Mux',[sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator/Mux']])
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator/Mux']],...
'inputs','3',...
'position',[100,77,130,113])
add_block('built-in/Inport',[sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator/in_2']])
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator/in_2']],...
'Port','2',...
'position',[55,85,75,105])
add_block('built-in/S-Function',[sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator/S-function',13,'block ']])
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator/S-function',13,'block ']],...
'function name','sfunid',...
'parameters','order,npts,HowOften,offset,ts,method',...
'position',[200,75,255,115])
add_block('built-in/Inport',[sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator/in_1']])
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator/in_1']],...
'position',[55,35,75,55])
add_line([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']],[80,145;95,105])
add_line([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']],[135,95;195,95])
add_line([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']],[80,45;95,85])
add_line([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']],[80,95;95,95])
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']],...
'Mask Display','ARMAX',...
'Mask Type','ARMAX')
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']],...
'Mask Dialogue','ARMAX model estimator.\nHook input 1 to system input.\nHook input 2 to system output.|Length of buffer:|Orders of model [na nb nc nk]|Calculate after how many points:|Sample time:')
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']],...
'Mask Translate','method = ''armax''; npts=@1; order=@2; HowOften=@3; ts=@4(1); if length(@4) > 1, offset = @4(2), else, offset = 0; end')
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']],...
'Mask Help','Hook the system''s input to the first port of this block and the system''s output to second port. The input noise, which is optional, may be hooked to input 3.\nResults are displayed as the estimated output versus the true output in graphical form. Use signals with high harmonic content for best results. ')
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']],...
'Mask Entries','256\/[3 3 3 0]\/64\/0.05\/')
% Finished composite block ['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator'].
set_param([sys,'/',['AutoRegressive Moving',13,'Average with eXternal',13,'input model estimator']],...
'Drop Shadow',4,...
'position',[330,93,385,147])
% Subsystem ['Box-Jenkins',13,'model estimator'].
new_system([sys,'/',['Box-Jenkins',13,'model estimator']])
set_param([sys,'/',['Box-Jenkins',13,'model estimator']],'Location',[0,0,371,185])
add_block('built-in/Inport',[sys,'/',['Box-Jenkins',13,'model estimator/input noise']])
set_param([sys,'/',['Box-Jenkins',13,'model estimator/input noise']],...
'Port','3',...
'position',[55,140,75,160])
add_block('built-in/Mux',[sys,'/',['Box-Jenkins',13,'model estimator/Mux']])
set_param([sys,'/',['Box-Jenkins',13,'model estimator/Mux']],...
'inputs','3',...
'position',[130,82,160,118])
add_block('built-in/Inport',[sys,'/',['Box-Jenkins',13,'model estimator/system output']])
set_param([sys,'/',['Box-Jenkins',13,'model estimator/system output']],...
'Port','2',...
'position',[55,90,75,110])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -