⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blockident.m

📁 realize analysis and design for computer-controlled system
💻 M
字号:
function [ret,x0,str,ts,xts]=blockident(t,x,u,flag);%BLOCKIDENT	is the M-file description of the SIMULINK system named BLOCKIDENT.%	The block-diagram can be displayed by typing: BLOCKIDENT.%%	SYS=BLOCKIDENT(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 BLOCKIDENT 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 BLOCKIDENT with a FLAG of zero:%	[SIZES]=BLOCKIDENT([],[],[],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',[515,572,1015,872])     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/Mux',[sys,'/','Mux'])set_param([sys,'/','Mux'],...		'hide name',0,...		'inputs','2',...		'position',[135,106,165,139])add_block('built-in/Discrete State-Space',[sys,'/','Discrete State-Space'])set_param([sys,'/','Discrete State-Space'],...		'hide name',0,...		'A','[-a1 1;-a2 0]',...		'B','[c1-a1 b1;c2-a2 b2]',...		'C','[1 0]',...		'D','[1 0]',...		'position',[185,103,300,147])%     Subsystem  ['Band-Limited',13,'White Noise'].new_system([sys,'/',['Band-Limited',13,'White Noise']])set_param([sys,'/',['Band-Limited',13,'White Noise']],'Location',[54,341,339,470])add_block('built-in/Outport',[sys,'/',['Band-Limited',13,'White Noise/Out_1']])set_param([sys,'/',['Band-Limited',13,'White Noise/Out_1']],...		'position',[230,40,250,60])add_block('built-in/Gain',[sys,'/',['Band-Limited',13,'White Noise/Gain']])set_param([sys,'/',['Band-Limited',13,'White Noise/Gain']],...		'Gain','[sqrt(Cov)]/[sqrt(Ts)]',...		'position',[155,31,195,69])add_block('built-in/Zero-Order Hold',[sys,'/',['Band-Limited',13,'White Noise/Zero-Order',13,'Hold']])set_param([sys,'/',['Band-Limited',13,'White Noise/Zero-Order',13,'Hold']],...		'Sample time','Ts',...		'position',[85,34,120,66])add_block('built-in/White Noise',[sys,'/',['Band-Limited',13,'White Noise/White Noise']])set_param([sys,'/',['Band-Limited',13,'White Noise/White Noise']],...		'Seed','seed',...		'position',[25,40,45,60])add_line([sys,'/',['Band-Limited',13,'White Noise']],[50,50;80,50])add_line([sys,'/',['Band-Limited',13,'White Noise']],[200,50;225,50])add_line([sys,'/',['Band-Limited',13,'White Noise']],[125,50;150,50])set_param([sys,'/',['Band-Limited',13,'White Noise']],...		'Mask Display','plot(t(:),r2(:))',...		'Mask Type','Continuous White Noise.')set_param([sys,'/',['Band-Limited',13,'White Noise']],...		'Mask Dialogue','White noise for continuous (s-domain) systems.\nBand-limited using zero-order-hold.|Noise Power:|Sample Time:|Seed')set_param([sys,'/',['Band-Limited',13,'White Noise']],...		'Mask Translate','Cov = @1; Ts = @2; seed = @3; r = rand(1,12); r2 = [r(1),r;r,r(12)]; t =[1:13;1:13];')set_param([sys,'/',['Band-Limited',13,'White Noise']],...		'Mask Help','Implemented using white noise into Zero-Order Hold block. The seed and power can be vectors of the same length to produce a vector of white noise sources. For faster simulation, set sample time to the highest value possible but in accordance with the fastest dynamics of system.')set_param([sys,'/',['Band-Limited',13,'White Noise']],...		'Mask Entries','[0.1]\/1\/[23341]\/')%     Finished composite block ['Band-Limited',13,'White Noise'].set_param([sys,'/',['Band-Limited',13,'White Noise']],...		'hide name',0,...		'position',[25,72,70,108])%     Subsystem  ['Repeating',13,'Sequence'].new_system([sys,'/',['Repeating',13,'Sequence']])set_param([sys,'/',['Repeating',13,'Sequence']],'Location',[5,40,315,196])add_block('built-in/Outport',[sys,'/',['Repeating',13,'Sequence/out_1']])set_param([sys,'/',['Repeating',13,'Sequence/out_1']],...		'position',[285,60,305,80])add_block('built-in/Look Up Table',[sys,'/',['Repeating',13,'Sequence/Look-Up Table']])set_param([sys,'/',['Repeating',13,'Sequence/Look-Up Table']],...		'Input_Values','t',...		'Output_Values','y',...		'position',[210,58,250,82])add_block('built-in/Fcn',[sys,'/',['Repeating',13,'Sequence/Fcn1']])set_param([sys,'/',['Repeating',13,'Sequence/Fcn1']],...		'Expr','rem(u[1],period)',...		'position',[110,60,150,80])add_block('built-in/Clock',[sys,'/',['Repeating',13,'Sequence/Clock']])set_param([sys,'/',['Repeating',13,'Sequence/Clock']],...		'position',[45,60,65,80])add_line([sys,'/',['Repeating',13,'Sequence']],[255,70;280,70])add_line([sys,'/',['Repeating',13,'Sequence']],[70,70;105,70])add_line([sys,'/',['Repeating',13,'Sequence']],[155,70;205,70])set_param([sys,'/',['Repeating',13,'Sequence']],...		'Mask Display','plot([t,t+period,t+2*period],[y,y,y])',...		'Mask Type','Repeating table')set_param([sys,'/',['Repeating',13,'Sequence']],...		'Mask Dialogue','Repeating table.\nEnter values of time and output for first cycle.|Time values:|Output values:',...		'Mask Translate','period = max(@1); t = @1; y = @2;')set_param([sys,'/',['Repeating',13,'Sequence']],...		'Mask Help','Repeats cycle given in table. Time values should be monotonically increasing.',...		'Mask Entries','[0 50 51 100]\/[1 1 -1 -1]\/')%     Finished composite block ['Repeating',13,'Sequence'].set_param([sys,'/',['Repeating',13,'Sequence']],...		'hide name',0,...		'position',[30,147,65,183])add_block('built-in/Outport',[sys,'/','Outport1'])set_param([sys,'/','Outport1'],...		'hide name',0,...		'Port','2',...		'position',[160,225,180,245])add_block('built-in/Outport',[sys,'/','Outport'])set_param([sys,'/','Outport'],...		'hide name',0,...		'position',[360,115,380,135])add_line(sys,[170,125;180,125])add_line(sys,[75,90;95,90;95,115;130,115])add_line(sys,[70,165;95,165;95,130;130,130])add_line(sys,[70,165;110,165;110,235;155,235])add_line(sys,[305,125;355,125])drawnow% 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,ts,xts]=',sys,'(t,x,u,flag);'])		else			eval(['ret =', sys,'(t,x,u,flag);'])		end	else		[ret,x0,str,ts,xts] = feval(sys);	endelse	drawnow % Flash up the model and execute load callbackend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -