📄 tutconcd.m
字号:
function [ret,x0,str,ts,xts]=tutconcd(t,x,u,flag);
%TUTCONCD is the M-file description of the SIMULINK system named TUTCONCD.
% The block-diagram can be displayed by typing: TUTCONCD.
%
% SYS=TUTCONCD(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 TUTCONCD 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 TUTCONCD with a FLAG of zero:
% [SIZES]=TUTCONCD([],[],[],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',[4,126,770,248])
open_system(sys)
end;
set_param(sys,'algorithm', 'RK-45')
set_param(sys,'Start time', '0.0')
set_param(sys,'Stop time', '3000')
set_param(sys,'Min step size', '0.0001')
set_param(sys,'Max step size', '1')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars', '')
add_block('built-in/S-Function',[sys,'/',['Integer scalar',13,'to vector']])
set_param([sys,'/',['Integer scalar',13,'to vector']],...
'hide name',0,...
'function name','simde2bi',...
'parameters','len, p',...
'Mask Display','Sca to vec\nconverter',...
'Mask Type','Decimal to base M vector')
set_param([sys,'/',['Integer scalar',13,'to vector']],...
'Mask Dialogue','Convert decimal integer input to base M\ninteger and output each position of the\nconverted integer using output vector.|Output vector length:|Conversion base M:')
set_param([sys,'/',['Integer scalar',13,'to vector']],...
'Mask Translate','len=@1;p=@2;')
set_param([sys,'/',['Integer scalar',13,'to vector']],...
'Mask Help','This block converts decimal integer scalar input to a base M integer. M must be a\npositive integer. The block outputs the base M integer using a vector. The 1st element in the output vector contains the 1''s position. The 2nd element in the output vector contains the M''s position, and so on. The output vector length is given by setting the parameter entry.')
set_param([sys,'/',['Integer scalar',13,'to vector']],...
'Mask Entries','2\/2\/',...
'position',[115,38,195,82])
% Subsystem ['Binary error',13,'channel'].
new_system([sys,'/',['Binary error',13,'channel']])
set_param([sys,'/',['Binary error',13,'channel']],'Location',[141,255,620,460])
add_block('built-in/Outport',[sys,'/',['Binary error',13,'channel/out_2']])
set_param([sys,'/',['Binary error',13,'channel/out_2']],...
'Port','2',...
'position',[275,125,295,145])
add_block('built-in/Saturation',[sys,'/',['Binary error',13,'channel/Saturation']])
set_param([sys,'/',['Binary error',13,'channel/Saturation']],...
'Lower Limit','0',...
'Upper Limit','1',...
'position',[165,70,190,90])
add_block('built-in/S-Function',[sys,'/',['Binary error',13,'channel/Modulo',13,'operation']])
set_param([sys,'/',['Binary error',13,'channel/Modulo',13,'operation']],...
'function name','arymodu',...
'parameters','md',...
'Mask Display','Modulo',...
'Mask Type','Modulo',...
'Mask Dialogue','Modulo operation:|Modulo base:')
set_param([sys,'/',['Binary error',13,'channel/Modulo',13,'operation']],...
'Mask Translate','md = @1;')
set_param([sys,'/',['Binary error',13,'channel/Modulo',13,'operation']],...
'Mask Help','This block output modulus operation of the input signal with module base as specified in block entry. The length of the output vector is the same as the input vector.')
set_param([sys,'/',['Binary error',13,'channel/Modulo',13,'operation']],...
'Mask Entries','2\/',...
'position',[300,56,360,94])
add_block('built-in/Sum',[sys,'/',['Binary error',13,'channel/Sum']])
set_param([sys,'/',['Binary error',13,'channel/Sum']],...
'position',[235,65,255,85])
add_block('built-in/Outport',[sys,'/',['Binary error',13,'channel/out_1']])
set_param([sys,'/',['Binary error',13,'channel/out_1']],...
'position',[390,65,410,85])
% Subsystem ['Binary error',13,'channel/Poisson',13,'noise'].
new_system([sys,'/',['Binary error',13,'channel/Poisson',13,'noise']])
set_param([sys,'/',['Binary error',13,'channel/Poisson',13,'noise']],'Location',[391,74,676,237])
add_block('built-in/Outport',[sys,'/',['Binary error',13,'channel/Poisson',13,'noise/out_1']])
set_param([sys,'/',['Binary error',13,'channel/Poisson',13,'noise/out_1']],...
'position',[165,65,185,85])
add_block('built-in/S-Function',[sys,'/',['Binary error',13,'channel/Poisson',13,'noise/Poisson distribution',13,'number']])
set_param([sys,'/',['Binary error',13,'channel/Poisson',13,'noise/Poisson distribution',13,'number']],...
'function name','srandpoi',...
'parameters','seed,lambda',...
'position',[65,55,135,95])
add_line([sys,'/',['Binary error',13,'channel/Poisson',13,'noise']],[140,75;160,75])
set_param([sys,'/',['Binary error',13,'channel/Poisson',13,'noise']],...
'Mask Display','Poison\nrand int',...
'Mask Type','Poisson distribution noise.',...
'Mask Dialogue','Poisson distribution number generator.|Lambda:|Seed:')
set_param([sys,'/',['Binary error',13,'channel/Poisson',13,'noise']],...
'Mask Translate','seed=@2;lambda=@1;')
set_param([sys,'/',['Binary error',13,'channel/Poisson',13,'noise']],...
'Mask Help','The output of this block is poisson distributed integers. The output size is the same as the vector size for seed. Please use function disttool to see the distribution of the outputof this block.')
set_param([sys,'/',['Binary error',13,'channel/Poisson',13,'noise']],...
'Mask Entries','P\/(randint(1, M)+100)*1000*max(P)\/')
% Finished composite block ['Binary error',13,'channel/Poisson',13,'noise'].
set_param([sys,'/',['Binary error',13,'channel/Poisson',13,'noise']],...
'position',[40,94,115,136])
add_block('built-in/Inport',[sys,'/',['Binary error',13,'channel/in_1']])
set_param([sys,'/',['Binary error',13,'channel/in_1']],...
'position',[95,30,115,50])
add_line([sys,'/',['Binary error',13,'channel']],[195,80;230,80])
add_line([sys,'/',['Binary error',13,'channel']],[210,80;210,135;270,135])
add_line([sys,'/',['Binary error',13,'channel']],[260,75;295,75])
add_line([sys,'/',['Binary error',13,'channel']],[120,115;140,115;140,80;160,80])
add_line([sys,'/',['Binary error',13,'channel']],[120,40;210,40;210,70;230,70])
add_line([sys,'/',['Binary error',13,'channel']],[365,75;385,75])
set_param([sys,'/',['Binary error',13,'channel']],...
'Mask Display','plot(0,0,100,100,x,y);B-error',...
'Mask Type','Add binary errors')
set_param([sys,'/',['Binary error',13,'channel']],...
'Mask Dialogue','The error probability can be a scalar or a vector with the same length as the\ninput vector length.|Error probability:|Input vector length:')
set_param([sys,'/',['Binary error',13,'channel']],...
'Mask Translate','M=@2;P=@1;if length(P)~=M,P=ones(1,M)*P(1);end;[x,y]=chanicon;')
set_param([sys,'/',['Binary error',13,'channel']],...
'Mask Help','This block adds binary errors to transmitted binary signals. The error probability is given in the parameter setting. The first output port outputs the transmitting signal (after adding noise). The second port outputs the errors signal added to the transmitting signal.')
set_param([sys,'/',['Binary error',13,'channel']],...
'Mask Entries','0.02\/3\/')
% Finished composite block ['Binary error',13,'channel'].
set_param([sys,'/',['Binary error',13,'channel']],...
'hide name',0,...
'position',[330,48,410,92])
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',[555,38,635,82])
% Subsystem ['Sampled read with',13,'synchronized pulse'].
new_system([sys,'/',['Sampled read with',13,'synchronized pulse']])
set_param([sys,'/',['Sampled read with',13,'synchronized pulse']],'Location',[355,527,737,674])
% Subsystem ['Sampled read with',13,'synchronized pulse/Pulses deivide',13,'same sample time1'].
new_system([sys,'/',['Sampled read with',13,'synchronized pulse/Pulses deivide',13,'same sample time1']])
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/Pulses deivide',13,'same sample time1']],'Location',[55,192,283,286])
add_block('built-in/S-Function',[sys,'/',['Sampled read with',13,'synchronized pulse/Pulses deivide',13,'same sample time1/S-function1']])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -