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

📄 simdemo.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 2 页
字号:
function [ret,x0,str,ts,xts]=simdemo(t,x,u,flag);
%SIMDEMO	is the M-file description of the SIMULINK system named SIMDEMO.
%	The block-diagram can be displayed by typing: SIMDEMO.
%
%	SYS=SIMDEMO(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 SIMDEMO 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 SIMDEMO with a FLAG of zero:
%	[SIZES]=SIMDEMO([],[],[],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',[15,89,499,498])
     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  'Button 1'.

new_system([sys,'/','Button 1'])
set_param([sys,'/','Button 1'],'Location',[514,124,650,277])
set_param([sys,'/','Button 1'],...
		'Mask Display','Parameter\nEstimation',...
		'Mask Dialogue','eval(''parmest'')')


%     Finished composite block 'Button 1'.

set_param([sys,'/','Button 1'],...
		'hide name',0,...
		'position',[45,25,160,95])


%     Subsystem  'Button 2'.

new_system([sys,'/','Button 2'])
set_param([sys,'/','Button 2'],'Location',[-10,380,117,533])
set_param([sys,'/','Button 2'],...
		'Mask Display','F-14 Flight\nControl',...
		'Mask Dialogue','eval(''f14dat; f14'')')


%     Finished composite block 'Button 2'.

set_param([sys,'/','Button 2'],...
		'hide name',0,...
		'position',[180,25,295,95])


%     Subsystem  'Button 4'.

new_system([sys,'/','Button 4'])
set_param([sys,'/','Button 4'],'Location',[-10,380,117,533])
set_param([sys,'/','Button 4'],...
		'Mask Display','Population\nVariation',...
		'Mask Dialogue','eval(''initial_pop=30;pops'')')


%     Finished composite block 'Button 4'.

set_param([sys,'/','Button 4'],...
		'hide name',0,...
		'position',[45,115,160,185])


%     Subsystem  'Button 5'.

new_system([sys,'/','Button 5'])
set_param([sys,'/','Button 5'],'Location',[-10,380,117,533])
set_param([sys,'/','Button 5'],...
		'Mask Display','Van der Pol\nEquations',...
		'Mask Dialogue','eval(''vdp'')')


%     Finished composite block 'Button 5'.

set_param([sys,'/','Button 5'],...
		'hide name',0,...
		'position',[315,115,430,185])


%     Subsystem  'Button 6'.

new_system([sys,'/','Button 6'])
set_param([sys,'/','Button 6'],'Location',[-10,380,117,533])
set_param([sys,'/','Button 6'],...
		'Mask Display','Step Size',...
		'Mask Dialogue','eval(''steps'')')


%     Finished composite block 'Button 6'.

set_param([sys,'/','Button 6'],...
		'hide name',0,...
		'position',[45,205,160,275])


%     Subsystem  'Button 3'.

new_system([sys,'/','Button 3'])
set_param([sys,'/','Button 3'],'Location',[-10,380,117,533])
set_param([sys,'/','Button 3'],...
		'Mask Display','Multi-Variate\nLines',...
		'Mask Dialogue','eval(''multi;'');')


%     Finished composite block 'Button 3'.

set_param([sys,'/','Button 3'],...
		'hide name',0,...
		'position',[315,25,430,95])


%     Subsystem  'Button 9'.

new_system([sys,'/','Button 9'])
set_param([sys,'/','Button 9'],'Location',[-10,380,117,533])
set_param([sys,'/','Button 9'],...
		'Mask Display','House\nThermostat',...
		'Mask Dialogue','eval(''thermdat; thermo'')')


%     Finished composite block 'Button 9'.

set_param([sys,'/','Button 9'],...
		'hide name',0,...
		'position',[180,115,295,185])


%     Subsystem  'Button 7'.

new_system([sys,'/','Button 7'])
set_param([sys,'/','Button 7'],'Location',[-10,380,117,533])
set_param([sys,'/','Button 7'],...
		'Mask Display','Sums & Products',...
		'Mask Dialogue','eval(''sumprod'')')


%     Finished composite block 'Button 7'.

set_param([sys,'/','Button 7'],...
		'hide name',0,...
		'position',[180,205,295,275])


%     Subsystem  'Library'.

new_system([sys,'/','Library'])
set_param([sys,'/','Library'],'Location',[41,141,398,423])


%     Subsystem  'Library/Button 1'.

new_system([sys,'/','Library/Button 1'])
set_param([sys,'/','Library/Button 1'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Button 1'],...
		'Mask Display','Sources',...
		'Mask Dialogue','eval(''sources'')')


%     Finished composite block 'Library/Button 1'.

set_param([sys,'/','Library/Button 1'],...
		'hide name',0,...
		'position',[35,30,100,80])


%     Subsystem  'Library/Button 2'.

new_system([sys,'/','Library/Button 2'])
set_param([sys,'/','Library/Button 2'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Button 2'],...
		'Mask Display','Sinks',...
		'Mask Dialogue','eval(''sinks'')')


%     Finished composite block 'Library/Button 2'.

set_param([sys,'/','Library/Button 2'],...
		'hide name',0,...
		'position',[140,30,203,79])


%     Subsystem  'Library/Button 3'.

new_system([sys,'/','Library/Button 3'])
set_param([sys,'/','Library/Button 3'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Button 3'],...
		'Mask Display','Linear\nBlocks',...
		'Mask Dialogue','eval(''linear'')')


%     Finished composite block 'Library/Button 3'.

set_param([sys,'/','Library/Button 3'],...
		'hide name',0,...
		'position',[240,30,304,80])


%     Subsystem  'Library/Button 6'.

new_system([sys,'/','Library/Button 6'])
set_param([sys,'/','Library/Button 6'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Button 6'],...
		'Mask Display','Ports',...
		'Mask Dialogue','eval(''portdemo'')')


%     Finished composite block 'Library/Button 6'.

set_param([sys,'/','Library/Button 6'],...
		'hide name',0,...
		'position',[240,155,302,207])


%     Subsystem  'Library/Button 5'.

new_system([sys,'/','Library/Button 5'])
set_param([sys,'/','Library/Button 5'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Button 5'],...
		'Mask Display','Discrete\nBlocks',...
		'Mask Dialogue','eval(''discrete'')')


%     Finished composite block 'Library/Button 5'.

set_param([sys,'/','Library/Button 5'],...
		'hide name',0,...
		'position',[140,155,203,208])


%     Subsystem  'Library/Button 4'.

new_system([sys,'/','Library/Button 4'])
set_param([sys,'/','Library/Button 4'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Button 4'],...
		'Mask Display','Nonlinear\nBlocks',...
		'Mask Dialogue','eval(''nonlin'')')


%     Finished composite block 'Library/Button 4'.

set_param([sys,'/','Library/Button 4'],...
		'hide name',0,...
		'position',[35,155,101,208])

add_block('built-in/Note',[sys,'/',['Library/Double click on any of ',13,'these blocks to see the ',13,'demo of your choice']])
set_param([sys,'/',['Library/Double click on any of ',13,'these blocks to see the ',13,'demo of your choice']],...
		'position',[170,225,175,230])


%     Subsystem  'Library/Special'.

new_system([sys,'/','Library/Special'])
set_param([sys,'/','Library/Special'],'Location',[291,337,740,678])

add_block('built-in/Note',[sys,'/','Library/Special/Double click on any of these blocks to see the demo of your choice'])
set_param([sys,'/','Library/Special/Double click on any of these blocks to see the demo of your choice'],...
		'position',[205,285,210,290])


%     Subsystem  'Library/Special/Button 3'.

new_system([sys,'/','Library/Special/Button 3'])
set_param([sys,'/','Library/Special/Button 3'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Special/Button 3'],...
		'Mask Display','Time Delay\nBlocks',...
		'Mask Dialogue','eval(''tdeldemo'')')


%     Finished composite block 'Library/Special/Button 3'.

set_param([sys,'/','Library/Special/Button 3'],...
		'hide name',0,...
		'position',[285,20,400,90])


%     Subsystem  'Library/Special/Button 6'.

new_system([sys,'/','Library/Special/Button 6'])
set_param([sys,'/','Library/Special/Button 6'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Special/Button 6'],...
		'Mask Display','XY Graph\nBlock',...
		'Mask Dialogue','eval(''lorenzs'')')


%     Finished composite block 'Library/Special/Button 6'.

set_param([sys,'/','Library/Special/Button 6'],...
		'hide name',0,...
		'position',[150,200,265,270])


%     Subsystem  'Library/Special/Button 5'.

new_system([sys,'/','Library/Special/Button 5'])
set_param([sys,'/','Library/Special/Button 5'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Special/Button 5'],...
		'Mask Display','Auto-Scale\nGraph Block',...
		'Mask Dialogue','eval(''lorenz2'')')


%     Finished composite block 'Library/Special/Button 5'.

set_param([sys,'/','Library/Special/Button 5'],...
		'hide name',0,...
		'position',[285,200,400,270])


%     Subsystem  'Library/Special/Button 2'.

new_system([sys,'/','Library/Special/Button 2'])
set_param([sys,'/','Library/Special/Button 2'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Special/Button 2'],...
		'Mask Display','Memory\nBlock',...
		'Mask Dialogue','eval(''memdemo'')')


%     Finished composite block 'Library/Special/Button 2'.

set_param([sys,'/','Library/Special/Button 2'],...
		'hide name',0,...
		'position',[150,20,265,90])


%     Subsystem  'Library/Special/Button 9'.

new_system([sys,'/','Library/Special/Button 9'])
set_param([sys,'/','Library/Special/Button 9'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Special/Button 9'],...
		'Mask Display','Zero- and First-\nOrder Hold\nBlocks',...
		'Mask Dialogue','eval(''fohdemo'')')


%     Finished composite block 'Library/Special/Button 9'.

set_param([sys,'/','Library/Special/Button 9'],...
		'hide name',0,...
		'position',[20,20,135,90])


%     Subsystem  'Library/Special/Button 4'.

new_system([sys,'/','Library/Special/Button 4'])
set_param([sys,'/','Library/Special/Button 4'],'Location',[-10,380,117,533])
set_param([sys,'/','Library/Special/Button 4'],...
		'Mask Display','Reset Integrator\nand\nHit Crossing Block',...
		'Mask Dialogue','eval(''bounce'')')


%     Finished composite block 'Library/Special/Button 4'.

set_param([sys,'/','Library/Special/Button 4'],...
		'hide name',0,...
		'position',[150,110,265,180])


%     Subsystem  'Library/Special/Button 1'.

new_system([sys,'/','Library/Special/Button 1'])
set_param([sys,'/','Library/Special/Button 1'],'Location',[514,124,650,277])
set_param([sys,'/','Library/Special/Button 1'],...
		'Mask Display','2-D Lookup Table\nBlock',...
		'Mask Dialogue','eval(''tabdemo'')')

⌨️ 快捷键说明

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