📄 mixed.m
字号:
function [ret,x0,str]=mixeds(t,x,u,flag);
%MIXEDS is the M-file description of the SIMULINK system named MIXEDS.
% The block-diagram can be displayed by typing: MIXEDS.
%
% SYS=MIXEDS(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 MIXEDS to return state derivitives, FLAG=2
% discrete states, FLAG=3 system outputs and FLAG=4 next sample
% time. For more information and other options see SFUNC.
%
% Calling MIXEDS with a FLAG of zero:
% [SIZES]=MIXEDS([],[],[],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.
% Copyright (c) 1990-94 by The MathWorks, Inc.
% 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',[14,58,382,193])
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/Integrator',[sys,'/','Cint'])
set_param([sys,'/','Cint'],...
'Initial','1',...
'position',[120,18,140,62])
add_block('built-in/Outport',[sys,'/','Outport'])
set_param([sys,'/','Outport'],...
'position',[255,30,275,50])
add_block('built-in/Unit Delay',[sys,'/','Dint'])
set_param([sys,'/','Dint'],...
'x0','1',...
'position',[185,14,205,66])
add_block('built-in/Inport',[sys,'/','Inport'])
set_param([sys,'/','Inport'],...
'position',[55,30,75,50])
add_line(sys,[145,40;175,40])
add_line(sys,[80,40;110,40])
add_line(sys,[210,40;245,40])
% 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 + -