📄 tstconcd.m
字号:
function [ret,x0,str,ts,xts]=tstconcd(t,x,u,flag);
%TSTCONCD is the M-file description of the SIMULINK system named TSTCONCD.
% The block-diagram can be displayed by typing: TSTCONCD.
%
% SYS=TSTCONCD(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 TSTCONCD 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 TSTCONCD with a FLAG of zero:
% [SIZES]=TSTCONCD([],[],[],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',[18,146,825,383])
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', '')
set_param(sys,'Load callback',['tf=sim2tran(''fig_10_9'');N_con_demo=tf(1,size(tf,2));K_con_demo=tf(2,size(tf,2));']);
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,43,635,87])
% Subsystem ['Binary error',13,'channel'].
new_system([sys,'/',['Binary error',13,'channel']])
set_param([sys,'/',['Binary error',13,'channel']],'Location',[154,494,633,699])
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])
% 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/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_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_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/Outport',[sys,'/',['Binary error',13,'channel/out_1']])
set_param([sys,'/',['Binary error',13,'channel/out_1']],...
'position',[390,65,410,85])
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/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/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/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_line([sys,'/',['Binary error',13,'channel']],[365,75;385,75])
add_line([sys,'/',['Binary error',13,'channel']],[120,40;210,40;210,70;230,70])
add_line([sys,'/',['Binary error',13,'channel']],[120,115;140,115;140,80;160,80])
add_line([sys,'/',['Binary error',13,'channel']],[260,75;295,75])
add_line([sys,'/',['Binary error',13,'channel']],[195,80;230,80])
add_line([sys,'/',['Binary error',13,'channel']],[210,80;210,135;270,135])
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\/N_con_demo\/')
% Finished composite block ['Binary error',13,'channel'].
set_param([sys,'/',['Binary error',13,'channel']],...
'hide name',0,...
'position',[330,53,410,97])
% Subsystem ['Binary vector',13,'convol encode'].
new_system([sys,'/',['Binary vector',13,'convol encode']])
set_param([sys,'/',['Binary vector',13,'convol encode']],'Location',[214,496,926,747])
add_block('built-in/Inport',[sys,'/',['Binary vector',13,'convol encode/in_1']])
set_param([sys,'/',['Binary vector',13,'convol encode/in_1']],...
'position',[25,60,45,80])
% Subsystem ['Binary vector',13,'convol encode/Rising edge',13,'detector'].
new_system([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']])
set_param([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],'Location',[282,116,671,290])
add_block('built-in/Relational Operator',[sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/Relational',13,'Operator']])
set_param([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/Relational',13,'Operator']],...
'position',[135,18,165,42])
add_block('built-in/Inport',[sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/in_1']])
set_param([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/in_1']],...
'position',[10,15,30,35])
add_block('built-in/Memory',[sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/Memory1']])
set_param([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/Memory1']],...
'position',[125,80,165,110])
add_block('built-in/Constant',[sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/one1']])
set_param([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/one1']],...
'Value','thld',...
'position',[30,135,60,155])
add_block('built-in/Relational Operator',[sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/Relational',13,'Operator2']])
set_param([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/Relational',13,'Operator2']],...
'Operator','>',...
'position',[265,23,295,47])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -