?? blk_lib.m
字號:
function [ret,x0,str]=blk_lib(t,x,u,flag);
%BLK_LIB is the M-file description of the SIMULINK system named BLK_LIB.
% The block-diagram can be displayed by typing: BLK_LIB.
%
% SYS=BLK_LIB(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 BLK_LIB 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 BLK_LIB with a FLAG of zero:
% [SIZES]=BLK_LIB([],[],[],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.
% 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.2)
if(0 == (nargin + nargout))
set_param(sys,'Location',[4,90,159,420])
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/Inport',[sys,'/','Input'])
set_param([sys,'/','Input'],...
'position',[25,60,45,80])
add_block('built-in/Outport',[sys,'/','Output'])
set_param([sys,'/','Output'],...
'position',[85,60,105,80])
add_block('built-in/Transfer Fcn',[sys,'/','Transfer Fcn'])
set_param([sys,'/','Transfer Fcn'],...
'Denominator','[1 1]',...
'position',[50,102,85,138])
add_block('built-in/Zero-Pole',[sys,'/','Zero-Pole'])
set_param([sys,'/','Zero-Pole'],...
'Poles','[0; -1]',...
'position',[45,167,90,203])
% Subsystem 'Simblock'.
new_system([sys,'/','Simblock'])
set_param([sys,'/','Simblock'],'Location',[-10,380,117,533])
set_param([sys,'/','Simblock'],...
'Mask Display','Return to The Control Kit',...
'Mask Type','',...
'Mask Dialogue','eval(''set_param(bname,''''Location'''',[0 0 0 0])'')',...
'Mask Translate','',...
'Mask Help','')
% Finished composite block 'Simblock'.
set_param([sys,'/','Simblock'],...
'hide name',0,...
'position',[10,281,135,320])
add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
'inputs','+-',...
'position',[25,15,45,35])
add_block('built-in/Integrator',[sys,'/','Integrator'])
set_param([sys,'/','Integrator'],...
'position',[85,15,105,35])
add_block('built-in/State-space',[sys,'/','State-space'])
set_param([sys,'/','State-space'],...
'position',[40,230,100,260])
% Return any arguments.
if (nargin | nargout)
% Must use feval here to access system in memory
if (nargin > 3)
if (flag == 0)
eval(['[ret,x0,str]=',sys,'(t,x,u,flag);'])
else
eval(['ret =', sys,'(t,x,u,flag);'])
end
else
[ret,x0,str] = feval(sys);
end
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -