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

📄 concdrtw.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 3 页
字号:
function [ret,x0,str,ts,xts]=concdrtw(t,x,u,flag);
%CONCDRTW	is the M-file description of the SIMULINK system named CONCDRTW.
%	The block-diagram can be displayed by typing: CONCDRTW.
%
%	SYS=CONCDRTW(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 CONCDRTW 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 CONCDRTW with a FLAG of zero:
%	[SIZES]=CONCDRTW([],[],[],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',[26,169,1004,348])
     open_system(sys)
end;
set_param(sys,'algorithm',     'Euler')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     '300')
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',   '[t,x,y]')
set_param(sys,'AssignSampleTimeColors','on');
set_param(sys,'AssignWideVectorLines','on');
set_param(sys,'Accelerate','external')
set_param(sys,'Nonreal-time algorithm','None')
set_param(sys,'Nonreal-time min step size','0.001')
set_param(sys,'Nonreal-time stop time','20')
set_param(sys,'Nonreal-time save workspace blocks','off')
set_param(sys,'Real-time algorithm','None')
set_param(sys,'Real-time step size','0.05')
set_param(sys,'Real-time template makefile','rti31.cmm')
set_param(sys,'Real-time build command','make_rt OPTS=-Dinf=1.e30')

add_block('built-in/S-Function',[sys,'/',['Integer vector',13,'to scalar']])
set_param([sys,'/',['Integer vector',13,'to scalar']],...
		'hide name',0,...
		'function name','simbi2de',...
		'parameters','p',...
		'Mask Display','Vec to sca\nconverter',...
		'Mask Type','Base M vector to decimal integer')
set_param([sys,'/',['Integer vector',13,'to scalar']],...
		'Mask Dialogue','Convert base M integer with each\nposition in the input vector into scalar decimal output.|Input integer base M:',...
		'Mask Translate','p=@1;')
set_param([sys,'/',['Integer vector',13,'to scalar']],...
		'Mask Help','This block convert the base M vector into scalar decimal integer output. Each element of the input vector is one position of the digit of the base M integer. The 1st element in the input vector contains the 1''s position. The 2nd element in the input vector contains the M''s position.')
set_param([sys,'/',['Integer vector',13,'to scalar']],...
		'Mask Entries','2\/',...
		'position',[665,48,745,92])

add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
		'hide name',0,...
		'position',[775,55,795,75])

add_block('built-in/Constant',[sys,'/','Constant'])
set_param([sys,'/','Constant'],...
		'hide name',0,...
		'Value','0',...
		'position',[705,10,725,30])

add_block('built-in/Gain',[sys,'/','Gain'])
set_param([sys,'/','Gain'],...
		'hide name',0,...
		'Gain','.1',...
		'position',[820,55,840,75])


%     Subsystem  'DS1102DA'.

new_system([sys,'/','DS1102DA'])
set_param([sys,'/','DS1102DA'],'Location',[12,124,275,390])


%     Subsystem  'DS1102DA/DAC_#1'.

new_system([sys,'/','DS1102DA/DAC_#1'])
set_param([sys,'/','DS1102DA/DAC_#1'],'Location',[125,40,274,186])

add_block('built-in/Gain',[sys,'/','DS1102DA/DAC_#1/DS_BOARD'])
set_param([sys,'/','DS1102DA/DAC_#1/DS_BOARD'],...
		'Gain','range_key',...
		'position',[60,60,80,80])

add_block('built-in/Inport',[sys,'/','DS1102DA/DAC_#1/in_1'])
set_param([sys,'/','DS1102DA/DAC_#1/in_1'],...
		'position',[10,60,30,80])

add_block('built-in/Outport',[sys,'/','DS1102DA/DAC_#1/out_1'])
set_param([sys,'/','DS1102DA/DAC_#1/out_1'],...
		'position',[110,60,130,80])
add_line([sys,'/','DS1102DA/DAC_#1'],[35,70;55,70])
add_line([sys,'/','DS1102DA/DAC_#1'],[85,70;105,70])
set_param([sys,'/','DS1102DA/DAC_#1'],...
		'Mask Display','DA',...
		'Mask Type','DA Converter',...
		'Mask Dialogue','DA Converter|range_key',...
		'Mask Translate','range_key=@1;',...
		'Mask Entries','10\/')


%     Finished composite block 'DS1102DA/DAC_#1'.

set_param([sys,'/','DS1102DA/DAC_#1'],...
		'position',[105,40,145,60])

add_block('built-in/Inport',[sys,'/','DS1102DA/in_1'])
set_param([sys,'/','DS1102DA/in_1'],...
		'position',[55,40,75,60])

add_block('built-in/Outport',[sys,'/','DS1102DA/out_1'])
set_param([sys,'/','DS1102DA/out_1'],...
		'position',[175,40,195,60])
add_line([sys,'/','DS1102DA'],[80,50;100,50])
add_line([sys,'/','DS1102DA'],[150,50;170,50])
set_param([sys,'/','DS1102DA'],...
		'Mask Display','DAC\nUnit',...
		'Mask Type','DS1102DA v2.0',...
		'Mask Dialogue','Voltage range for all DAC channels:\n\n[-10 +10] Volts',...
		'Mask Translate',' ')


%     Finished composite block 'DS1102DA'.

set_param([sys,'/','DS1102DA'],...
		'ForeGround',4,...
		'position',[865,44,895,86])


%     Subsystem  'OutPlug'.

new_system([sys,'/','OutPlug'])
set_param([sys,'/','OutPlug'],'Location',[0,0,152,163])

add_block('built-in/Gain',[sys,'/','OutPlug/DS_SOP'])
set_param([sys,'/','OutPlug/DS_SOP'],...
		'position',[100,50,120,70])

add_block('built-in/Inport',[sys,'/','OutPlug/input'])
set_param([sys,'/','OutPlug/input'],...
		'position',[30,50,50,70])
add_line([sys,'/','OutPlug'],[55,60;95,60])
set_param([sys,'/','OutPlug'],...
		'Mask Display','    S    ',...
		'Mask Type','Single output plug v2.0',...
		'Mask Dialogue','Single output plug')


%     Finished composite block 'OutPlug'.

set_param([sys,'/','OutPlug'],...
		'ForeGround',4,...
		'position',[930,59,955,71])


%     Subsystem  'InPlug'.

new_system([sys,'/','InPlug'])
set_param([sys,'/','InPlug'],'Location',[0,200,300,310])

add_block('built-in/Outport',[sys,'/','InPlug/output'])
set_param([sys,'/','InPlug/output'],...
		'position',[165,50,185,70])

add_block('built-in/Constant',[sys,'/','InPlug/DS_SIP'])
set_param([sys,'/','InPlug/DS_SIP'],...
		'Mask Display','         ',...
		'position',[50,54,90,66])
add_line([sys,'/','InPlug'],[95,60;160,60])
set_param([sys,'/','InPlug'],...
		'Mask Display','S',...
		'Mask Type','Single input plug v2.0',...
		'Mask Dialogue','Single input plug')


%     Finished composite block 'InPlug'.

set_param([sys,'/','InPlug'],...
		'ForeGround',4,...
		'position',[20,80,45,90])


%     Subsystem  'DS1102AD'.

new_system([sys,'/','DS1102AD'])
set_param([sys,'/','DS1102AD'],'Location',[386,108,620,415])


%     Subsystem  'DS1102AD/ADC_#1'.

new_system([sys,'/','DS1102AD/ADC_#1'])
set_param([sys,'/','DS1102AD/ADC_#1'],'Location',[125,40,274,186])

add_block('built-in/Outport',[sys,'/','DS1102AD/ADC_#1/out_1'])
set_param([sys,'/','DS1102AD/ADC_#1/out_1'],...
		'position',[110,60,130,80])

add_block('built-in/Inport',[sys,'/','DS1102AD/ADC_#1/in_1'])
set_param([sys,'/','DS1102AD/ADC_#1/in_1'],...
		'position',[10,60,30,80])

add_block('built-in/Gain',[sys,'/','DS1102AD/ADC_#1/DS_BOARD'])
set_param([sys,'/','DS1102AD/ADC_#1/DS_BOARD'],...
		'Gain','range_key',...
		'position',[60,60,80,80])
add_line([sys,'/','DS1102AD/ADC_#1'],[85,70;105,70])
add_line([sys,'/','DS1102AD/ADC_#1'],[35,70;55,70])
set_param([sys,'/','DS1102AD/ADC_#1'],...
		'Mask Display','AD',...
		'Mask Type','Mux-AD Converter',...
		'Mask Dialogue','Mux-AD Converter|range_key',...
		'Mask Translate','range_key=@1;',...
		'Mask Entries','P(1)\/')


%     Finished composite block 'DS1102AD/ADC_#1'.

set_param([sys,'/','DS1102AD/ADC_#1'],...
		'position',[100,70,140,90])

add_block('built-in/Inport',[sys,'/','DS1102AD/in_1'])
set_param([sys,'/','DS1102AD/in_1'],...
		'position',[50,70,70,90])

add_block('built-in/Outport',[sys,'/','DS1102AD/out_1'])
set_param([sys,'/','DS1102AD/out_1'],...
		'position',[170,70,190,90])
add_line([sys,'/','DS1102AD'],[145,80;165,80])
add_line([sys,'/','DS1102AD'],[75,80;95,80])
set_param([sys,'/','DS1102AD'],...
		'Mask Display','ADC\nUnit',...
		'Mask Type','DS1102AD v2.0',...
		'Mask Dialogue','Voltage range for all ADC channels:\n\n[-10 +10] Volts',...
		'Mask Translate','for i=1: 4, P(i) = 0.1;  end;  end ')


%     Finished composite block 'DS1102AD'.

set_param([sys,'/','DS1102AD'],...
		'ForeGround',4,...
		'position',[80,61,115,109])


⌨️ 快捷键说明

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