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

📄 lab0.m

📁 xnsy算法的matlab实现
💻 M
字号:
function [ret,x0,str,ts,xts]=lab0(t,x,u,flag);
%LAB0	is the M-file description of the SIMULINK system named LAB0.
%	The block-diagram can be displayed by typing: LAB0.
%
%	SYS=LAB0(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 LAB0 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 LAB0 with a FLAG of zero:
%	[SIZES]=LAB0([],[],[],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',[628,130,757,543])
     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,'/','元器件库'])
set_param([sys,'/','元器件库'],...
		'ForeGround',4,...
		'Font Size',18,...
		'position',[70,15,75,20])


%     Subsystem  ['Double click here',13,'to start loading data',13,'and mu-syn design4'].

new_system([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design4']])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design4']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design4']],...
		'Mask Display','离散线性\n环节器件库',...
		'Mask Dialogue','eval(''lab05'')')


%     Finished composite block ['Double click here',13,'to start loading data',13,'and mu-syn design4'].

set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design4']],...
		'ForeGround',4,...
		'hide name',0,...
		'Drop Shadow',4,...
		'position',[40,340,110,390])


%     Subsystem  ['Double click here',13,'to start loading data',13,'and mu-syn design3'].

new_system([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design3']])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design3']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design3']],...
		'Mask Display','非线性环节\n器件库',...
		'Mask Dialogue','eval(''lab04'')')


%     Finished composite block ['Double click here',13,'to start loading data',13,'and mu-syn design3'].

set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design3']],...
		'ForeGround',4,...
		'hide name',0,...
		'Drop Shadow',4,...
		'position',[40,275,110,325])


%     Subsystem  ['Double click here',13,'to start loading data',13,'and mu-syn design'].

new_system([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design']])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design']],...
		'Mask Display','输入\n器件库',...
		'Mask Dialogue','eval(''lab01'')')


%     Finished composite block ['Double click here',13,'to start loading data',13,'and mu-syn design'].

set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design']],...
		'ForeGround',4,...
		'hide name',0,...
		'Drop Shadow',4,...
		'position',[40,60,110,110])


%     Subsystem  ['Double click here',13,'to start loading data',13,'and mu-syn design2'].

new_system([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design2']])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design2']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design2']],...
		'Mask Display','连续线性\n环节器件库',...
		'Mask Dialogue','eval(''lab03'')')


%     Finished composite block ['Double click here',13,'to start loading data',13,'and mu-syn design2'].

set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design2']],...
		'ForeGround',4,...
		'hide name',0,...
		'Drop Shadow',4,...
		'position',[40,200,110,250])


%     Subsystem  ['Double click here',13,'to start loading data',13,'and mu-syn design1'].

new_system([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']],...
		'Mask Display','输出\n器件库',...
		'Mask Dialogue','eval(''lab02'')')


%     Finished composite block ['Double click here',13,'to start loading data',13,'and mu-syn design1'].

set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']],...
		'ForeGround',4,...
		'hide name',0,...
		'Drop Shadow',4,...
		'position',[35,130,105,180])

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);
	end
else
	drawnow % Flash up the model and execute load callback
end

⌨️ 快捷键说明

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