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

📄 base98.m

📁 信号实验常用的simulink模型和mfile,可直接在matlan下运行。
💻 M
📖 第 1 页 / 共 2 页
字号:
function [ret,x0,str,ts,xts]=base98(t,x,u,flag);
%BASE98	is the M-file description of the SIMULINK system named BASE98.
%	The block-diagram can be displayed by typing: BASE98.
%
%	SYS=BASE98(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 BASE98 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 BASE98 with a FLAG of zero:
%	[SIZES]=BASE98([],[],[],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',[107,59,481,229])
     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',   '')


%     Subsystem  '常用模块'.

new_system([sys,'/','常用模块'])
set_param([sys,'/','常用模块'],'Location',[-10,380,117,533])
set_param([sys,'/','常用模块'],...
		'Mask Display','模块库',...
		'Mask Dialogue','eval(''axzblock'')')


%     Finished composite block '常用模块'.

set_param([sys,'/','常用模块'],...
		'Font Name','宋体',...
		'Font Size',12,...
		'position',[215,34,280,96])


%     Subsystem  ['毕业设计 ''98'].

new_system([sys,'/',['毕业设计 ''98']])
set_param([sys,'/',['毕业设计 ''98']],'Location',[23,42,382,449])

add_block('built-in/Transfer Fcn',[sys,'/',['毕业设计 ''98/单元7']])
set_param([sys,'/',['毕业设计 ''98/单元7']],...
		'Font Name','宋体',...
		'Font Size',12,...
		'Drop Shadow',4,...
		'Denominator','[L*C R*C 1]')
set_param([sys,'/',['毕业设计 ''98/单元7']],...
		'Mask Display','plot([3 5 5 5],[2 2 1.5 2.5],[5 9],[2.5 2.5],[5 9],[1.5 1.5],[9 9],[2.5 1.5],[9 11],[2 2],[11:1/7:12],[2 2.5 2.707 2.866 2.866 2.707 2.5 2],[12:1/7:13],[2 2.5 2.707 2.866 2.866 2.707 2.5 2],[13:1/7:14],[2 2.5 2.707 2.866 2.866 2.707 2.5 2],[14:1/7:15],[2 2.5 2.707 2.866 2.866 2.707 2.5 2],[15 21],[2 2],[18 18 16 20],[2 0 0 0],[16 20],[-1 -1],[18 18 17 19],[-1 -3 -3 -3]);')
set_param([sys,'/',['毕业设计 ''98/单元7']],...
		'Mask Type',' 单元7',...
		'Mask Dialogue',' 单元7|电阻值(欧):|电感值(亨):|电容值(法):',...
		'Mask Translate','R=@1;L=@2;C=@3;',...
		'Mask Entries','1\/1\/1\/')
set_param([sys,'/',['毕业设计 ''98/单元7']],...
		'position',[140,295,260,345])

add_block('built-in/Transfer Fcn',[sys,'/',['毕业设计 ''98/单元6']])
set_param([sys,'/',['毕业设计 ''98/单元6']],...
		'Font Name','宋体',...
		'Font Size',12,...
		'Drop Shadow',4,...
		'Numerator','[R]',...
		'Denominator','[R*C R+1]')
set_param([sys,'/',['毕业设计 ''98/单元6']],...
		'Mask Display','plot([0 15],[2 2],[8 8 6 10],[2 0 0 0],[6 10],[-1 -1],[8 8 7 9],[-1 -4 -4 -4],[12.5 12.5 12 13],[2 1 1 1],[12 12],[1 -3],[13 13],[1 -3],[12 13 12.5 12.5],[-3 -3 -3 -4],[12 13],[-4 -4]);')
set_param([sys,'/',['毕业设计 ''98/单元6']],...
		'Mask Type','单元6',...
		'Mask Dialogue','单元6|电阻值(欧):|电容值(法):',...
		'Mask Translate','R=@1;C=@2;',...
		'Mask Entries','1\/1\/',...
		'position',[140,223,245,267])


%     Subsystem  ['毕业设计 ''98/Diode'].

new_system([sys,'/',['毕业设计 ''98/Diode']])
set_param([sys,'/',['毕业设计 ''98/Diode']],'Location',[4,207,504,457])

add_block('built-in/Gain',[sys,'/',['毕业设计 ''98/Diode/Gain']])
set_param([sys,'/',['毕业设计 ''98/Diode/Gain']],...
		'Gain','1/2',...
		'position',[340,117,365,143])

add_block('built-in/Sum',[sys,'/',['毕业设计 ''98/Diode/Sum']])
set_param([sys,'/',['毕业设计 ''98/Diode/Sum']],...
		'position',[270,120,290,140])

add_block('built-in/Product',[sys,'/',['毕业设计 ''98/Diode/Product']])
set_param([sys,'/',['毕业设计 ''98/Diode/Product']],...
		'position',[195,123,225,147])


%     Subsystem  ['毕业设计 ''98/Diode/Sign'].

new_system([sys,'/',['毕业设计 ''98/Diode/Sign']])
set_param([sys,'/',['毕业设计 ''98/Diode/Sign']],'Location',[159,289,467,458])

add_block('built-in/Outport',[sys,'/',['毕业设计 ''98/Diode/Sign/out_1']])
set_param([sys,'/',['毕业设计 ''98/Diode/Sign/out_1']],...
		'position',[265,70,285,90])

add_block('built-in/Inport',[sys,'/',['毕业设计 ''98/Diode/Sign/in_1']])
set_param([sys,'/',['毕业设计 ''98/Diode/Sign/in_1']],...
		'position',[35,30,55,50])

add_block('built-in/Relational Operator',[sys,'/',['毕业设计 ''98/Diode/Sign/Relational',13,'Operator']])
set_param([sys,'/',['毕业设计 ''98/Diode/Sign/Relational',13,'Operator']],...
		'Operator','>',...
		'position',[140,32,170,63])

add_block('built-in/Sum',[sys,'/',['毕业设计 ''98/Diode/Sign/Sum']])
set_param([sys,'/',['毕业设计 ''98/Diode/Sign/Sum']],...
		'inputs','+-',...
		'position',[215,64,235,91])

add_block('built-in/Relational Operator',[sys,'/',['毕业设计 ''98/Diode/Sign/Relational',13,'Operator1']])
set_param([sys,'/',['毕业设计 ''98/Diode/Sign/Relational',13,'Operator1']],...
		'Operator','<',...
		'position',[140,92,170,123])

add_block('built-in/Constant',[sys,'/',['毕业设计 ''98/Diode/Sign/Constant']])
set_param([sys,'/',['毕业设计 ''98/Diode/Sign/Constant']],...
		'Value','0',...
		'position',[65,105,85,125])
add_line([sys,'/',['毕业设计 ''98/Diode/Sign']],[60,40;135,40])
add_line([sys,'/',['毕业设计 ''98/Diode/Sign']],[95,40;95,100;135,100])
add_line([sys,'/',['毕业设计 ''98/Diode/Sign']],[90,115;135,115])
add_line([sys,'/',['毕业设计 ''98/Diode/Sign']],[110,115;110,55;135,55])
add_line([sys,'/',['毕业设计 ''98/Diode/Sign']],[175,110;185,110;185,85;210,85])
add_line([sys,'/',['毕业设计 ''98/Diode/Sign']],[175,50;185,50;185,70;210,70])
add_line([sys,'/',['毕业设计 ''98/Diode/Sign']],[240,80;260,80])
set_param([sys,'/',['毕业设计 ''98/Diode/Sign']],...
		'Mask Display','plot(-50,-50,50,50,[-50,50],[0,0],[0,0],[-50,50],[-40,0],[-30,-30],[0,40],[30,30])',...
		'Mask Type','Sign',...
		'Mask Dialogue','y = sign(x)')
set_param([sys,'/',['毕业设计 ''98/Diode/Sign']],...
		'Mask Help','Sign Function:\n\t\t\ty = 1 if x > 0\n\t\t\ty = 0 if x = 0\n\t\t\ty = -1 if x < 0')


%     Finished composite block ['毕业设计 ''98/Diode/Sign'].

set_param([sys,'/',['毕业设计 ''98/Diode/Sign']],...
		'position',[120,117,150,143])

add_block('built-in/Outport',[sys,'/',['毕业设计 ''98/Diode/out_1']])
set_param([sys,'/',['毕业设计 ''98/Diode/out_1']],...
		'position',[395,120,415,140])

add_block('built-in/Inport',[sys,'/',['毕业设计 ''98/Diode/in_1']])
set_param([sys,'/',['毕业设计 ''98/Diode/in_1']],...
		'position',[70,120,90,140])
add_line([sys,'/',['毕业设计 ''98/Diode']],[295,130;335,130])
add_line([sys,'/',['毕业设计 ''98/Diode']],[95,130;100,90;245,90;245,125;265,125])
add_line([sys,'/',['毕业设计 ''98/Diode']],[230,135;265,135])
add_line([sys,'/',['毕业设计 ''98/Diode']],[95,130;100,180;170,180;170,140;190,140])

⌨️ 快捷键说明

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