📄 lchou.m
字号:
function [ret,x0,str,ts,xts]=lchou(t,x,u,flag);
%LCHOU is the M-file description of the SIMULINK system named LCHOU.
% LCHOU has a the following characteristics:
% 0 continuous states
% 12 discrete states
% 0 outputs
% 0 inputs
% does not have direct feedthrough
% 6 sample times
%
% The block-diagram can be displayed by typing: LCHOU.
%
% SYS=LCHOU(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 LCHOU 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 LCHOU with a FLAG of zero:
% [SIZES]=LCHOU([],[],[],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',[4,160,628,460])
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.000001')
set_param(sys,'Max step size', '0.01')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars', '')
add_block('built-in/Scope',[sys,'/','Scope'])
set_param([sys,'/','Scope'],...
'Vgain','1.500000',...
'Hgain','12.480000',...
'Vmax','3.000000',...
'Hmax','24.960000',...
'Window',[0,0,331,314],...
'position',[85,145,115,175])
add_block('built-in/Scope',[sys,'/','Scope1'])
set_param([sys,'/','Scope1'],...
'Vgain','1.500000',...
'Hgain','12.480000',...
'Vmax','3.000000',...
'Hmax','24.960000',...
'Window',[309,166,640,480],...
'position',[420,170,450,200])
% Subsystem ['Pulse',13,'Generator1'].
new_system([sys,'/',['Pulse',13,'Generator1']])
set_param([sys,'/',['Pulse',13,'Generator1']],'Location',[158,441,759,682])
add_block('built-in/Outport',[sys,'/',['Pulse',13,'Generator1/out_1']])
set_param([sys,'/',['Pulse',13,'Generator1/out_1']],...
'hide name',0,...
'position',[560,105,580,125])
add_block('built-in/Gain',[sys,'/',['Pulse',13,'Generator1/Gain']])
set_param([sys,'/',['Pulse',13,'Generator1/Gain']],...
'hide name',0,...
'Gain','ht',...
'position',[510,102,535,128])
add_block('built-in/Product',[sys,'/',['Pulse',13,'Generator1/Product']])
set_param([sys,'/',['Pulse',13,'Generator1/Product']],...
'hide name',0,...
'position',[455,105,480,125])
add_block('built-in/Logical Operator',[sys,'/',['Pulse',13,'Generator1/Logical',13,'Operator1']])
set_param([sys,'/',['Pulse',13,'Generator1/Logical',13,'Operator1']],...
'Operator','NOT',...
'Number of Input Ports','1',...
'position',[355,38,385,62])
add_block('built-in/Logical Operator',[sys,'/',['Pulse',13,'Generator1/Logical',13,'Operator']])
set_param([sys,'/',['Pulse',13,'Generator1/Logical',13,'Operator']],...
'Operator','XOR',...
'position',[285,38,315,62])
add_block('built-in/Constant',[sys,'/',['Pulse',13,'Generator1/Constant1']])
set_param([sys,'/',['Pulse',13,'Generator1/Constant1']],...
'Value','stt',...
'position',[295,149,320,171])
add_block('built-in/Clock',[sys,'/',['Pulse',13,'Generator1/Clock1']])
set_param([sys,'/',['Pulse',13,'Generator1/Clock1']],...
'hide name',0,...
'position',[295,100,315,120])
add_block('built-in/Relational Operator',[sys,'/',['Pulse',13,'Generator1/Relational',13,'operator']])
set_param([sys,'/',['Pulse',13,'Generator1/Relational',13,'operator']],...
'hide name',0,...
'position',[370,102,400,133])
add_block('built-in/Sum',[sys,'/',['Pulse',13,'Generator1/Sum1']])
set_param([sys,'/',['Pulse',13,'Generator1/Sum1']],...
'hide name',0,...
'inputs','+-',...
'position',[130,120,150,140])
add_block('built-in/Sum',[sys,'/',['Pulse',13,'Generator1/Sum']])
set_param([sys,'/',['Pulse',13,'Generator1/Sum']],...
'hide name',0,...
'inputs','+-',...
'position',[135,35,155,55])
add_block('built-in/Constant',[sys,'/',['Pulse',13,'Generator1/Constant']])
set_param([sys,'/',['Pulse',13,'Generator1/Constant']],...
'position',[25,30,45,50])
add_block('built-in/Unit Delay',[sys,'/',['Pulse',13,'Generator1/Unit Delay']])
set_param([sys,'/',['Pulse',13,'Generator1/Unit Delay']],...
'orientation',2,...
'Sample time','[Ts,st1]',...
'position',[145,75,195,95])
add_block('built-in/Unit Delay',[sys,'/',['Pulse',13,'Generator1/Unit Delay1']])
set_param([sys,'/',['Pulse',13,'Generator1/Unit Delay1']],...
'orientation',2,...
'Sample time','[Ts,st2]',...
'x0','ini',...
'position',[140,165,190,185])
add_line([sys,'/',['Pulse',13,'Generator1']],[390,50;430,50;430,110;450,110])
add_line([sys,'/',['Pulse',13,'Generator1']],[320,50;350,50])
add_line([sys,'/',['Pulse',13,'Generator1']],[325,160;345,160;345,125;365,125])
add_line([sys,'/',['Pulse',13,'Generator1']],[540,115;555,115])
add_line([sys,'/',['Pulse',13,'Generator1']],[485,115;505,115])
add_line([sys,'/',['Pulse',13,'Generator1']],[405,120;450,120])
add_line([sys,'/',['Pulse',13,'Generator1']],[320,110;365,110])
add_line([sys,'/',['Pulse',13,'Generator1']],[140,85;105,85;105,50;130,50])
add_line([sys,'/',['Pulse',13,'Generator1']],[160,45;230,45;230,85;200,85])
add_line([sys,'/',['Pulse',13,'Generator1']],[50,40;130,40])
add_line([sys,'/',['Pulse',13,'Generator1']],[155,130;210,130;210,175;195,175])
add_line([sys,'/',['Pulse',13,'Generator1']],[135,175;100,175;100,135;125,135])
add_line([sys,'/',['Pulse',13,'Generator1']],[50,40;70,40;70,125;125,125])
add_line([sys,'/',['Pulse',13,'Generator1']],[160,45;280,45])
add_line([sys,'/',['Pulse',13,'Generator1']],[155,130;245,130;245,55;280,55])
set_param([sys,'/',['Pulse',13,'Generator1']],...
'Mask Display','plot(0,0,100,100,[90,75,75,60,60,35,35,20,20,10],[20,20,80,80,20,20,80,80,20,20])',...
'Mask Type','Pulse Generator')
set_param([sys,'/',['Pulse',13,'Generator1']],...
'Mask Dialogue','Pulse Generator.|Pulse period (secs):|Pulse width:|Pulse height:|Pulse start time:')
set_param([sys,'/',['Pulse',13,'Generator1']],...
'Mask Translate','Ts=@1; du=@2; ht=@3; stt=@4; ini=ones(length(ht),1); st1=rem(stt,Ts); st2=rem(stt+du,Ts);if(Ts<=1.2*du),ini=zeros(length(ht),1);end;')
set_param([sys,'/',['Pulse',13,'Generator1']],...
'Mask Help','Pulse generator which ensures pulse\ntransitions are hit. Provides a vector of pulses when the height is entered as a vector.\nUnmask to see how it works.')
set_param([sys,'/',['Pulse',13,'Generator1']],...
'Mask Entries','pi/50\/0.001\/1\/0.\/')
% Finished composite block ['Pulse',13,'Generator1'].
set_param([sys,'/',['Pulse',13,'Generator1']],...
'position',[190,142,225,178])
add_block('built-in/Scope',[sys,'/','Scope6'])
set_param([sys,'/','Scope6'],...
'Vgain','1.120000',...
'Hgain','1.920000',...
'Vmax','2.240000',...
'Hmax','3.840000',...
'Window',[433,98,764,412],...
'position',[290,200,320,230])
% Subsystem 'Subsystem'.
new_system([sys,'/','Subsystem'])
set_param([sys,'/','Subsystem'],'Location',[4,117,308,460])
add_block('built-in/Scope',[sys,'/','Subsystem/Scope4'])
set_param([sys,'/','Subsystem/Scope4'],...
'Vgain','1.300000',...
'Hgain','12.240000',...
'Vmax','2.600000',...
'Hmax','24.480000',...
'Window',[112,160,443,474],...
'position',[115,35,145,65])
add_block('built-in/Scope',[sys,'/','Subsystem/Scope5'])
set_param([sys,'/','Subsystem/Scope5'],...
'Vgain','1.200000',...
'Hgain','12.240000',...
'Vmax','2.400000',...
'Hmax','24.480000',...
'Window',[112,160,443,474],...
'position',[110,250,140,280])
% Subsystem ['Subsystem/Pulse',13,'Generator'].
new_system([sys,'/',['Subsystem/Pulse',13,'Generator']])
set_param([sys,'/',['Subsystem/Pulse',13,'Generator']],'Location',[158,441,759,682])
add_block('built-in/Outport',[sys,'/',['Subsystem/Pulse',13,'Generator/out_1']])
set_param([sys,'/',['Subsystem/Pulse',13,'Generator/out_1']],...
'hide name',0,...
'position',[560,105,580,125])
add_block('built-in/Gain',[sys,'/',['Subsystem/Pulse',13,'Generator/Gain']])
set_param([sys,'/',['Subsystem/Pulse',13,'Generator/Gain']],...
'hide name',0,...
'Gain','ht',...
'position',[510,102,535,128])
add_block('built-in/Product',[sys,'/',['Subsystem/Pulse',13,'Generator/Product']])
set_param([sys,'/',['Subsystem/Pulse',13,'Generator/Product']],...
'hide name',0,...
'position',[455,105,480,125])
add_block('built-in/Logical Operator',[sys,'/',['Subsystem/Pulse',13,'Generator/Logical',13,'Operator1']])
set_param([sys,'/',['Subsystem/Pulse',13,'Generator/Logical',13,'Operator1']],...
'Operator','NOT',...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -