📄 tstcyclc.m
字号:
set_param([sys,'/',['Binary vector',13,'lin-blk decode']],...
'Mask Display','plot(0,0,100,100,x,y);Linear de',...
'Mask Type','Vector I/O linear block decode')
set_param([sys,'/',['Binary vector',13,'lin-blk decode']],...
'Mask Dialogue','Linear block decode with input codeword vector length N and output message vector length K.|Generator matrix (binary K-by-N matrix):|Error-correction truth table (0 for single error-corr):')
set_param([sys,'/',['Binary vector',13,'lin-blk decode']],...
'Mask Translate','G=@1;trt=@2;H=gen2par(G);if trt==0,trt=htruthtb(G);end;[n,m]=size(G);G=[zeros(n,m-n),eye(n)];[x,y]=codeicon(2);')
set_param([sys,'/',['Binary vector',13,'lin-blk decode']],...
'Mask Help','This block decodes length N binary vector codeword input into length K binary vector message output using linear block code. The generator matrix is a K-by-N matrix. Linear block code is a generic code. Use the HTRUTHTB function to generate a single error-correction truth table.')
set_param([sys,'/',['Binary vector',13,'lin-blk decode']],...
'Mask Entries','[[1 1 0; 0 1 1; 1 1 1;1 0 1] eye(4)]\/0\/')
% Finished composite block ['Binary vector',13,'lin-blk decode'].
set_param([sys,'/',['Binary vector',13,'lin-blk decode']],...
'hide name',0,...
'position',[525,33,605,77])
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',[635,33,715,77])
% Subsystem ['Binary vector',13,'lin-blk encode'].
new_system([sys,'/',['Binary vector',13,'lin-blk encode']])
set_param([sys,'/',['Binary vector',13,'lin-blk encode']],'Location',[235,592,599,711])
add_block('built-in/Inport',[sys,'/',['Binary vector',13,'lin-blk encode/in_1']])
set_param([sys,'/',['Binary vector',13,'lin-blk encode/in_1']],...
'position',[30,35,50,55])
add_block('built-in/State-Space',[sys,'/',['Binary vector',13,'lin-blk encode/Matrix',13,'Gain']])
set_param([sys,'/',['Binary vector',13,'lin-blk encode/Matrix',13,'Gain']],...
'A','[]',...
'B','[]',...
'C','[]',...
'D','K',...
'Mask Display','K',...
'Mask Type','Matrix Gain',...
'Mask Dialogue','Matrix Gain.|Gain matrix:')
set_param([sys,'/',['Binary vector',13,'lin-blk encode/Matrix',13,'Gain']],...
'Mask Translate','K = @1;',...
'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
'Mask Entries','G\/')
set_param([sys,'/',['Binary vector',13,'lin-blk encode/Matrix',13,'Gain']],...
'position',[110,31,135,59])
add_block('built-in/S-Function',[sys,'/',['Binary vector',13,'lin-blk encode/Modulus',13,'operation']])
set_param([sys,'/',['Binary vector',13,'lin-blk encode/Modulus',13,'operation']],...
'function name','arymodu',...
'parameters','md',...
'Mask Display','Modulo',...
'Mask Type','Modulo')
set_param([sys,'/',['Binary vector',13,'lin-blk encode/Modulus',13,'operation']],...
'Mask Dialogue','Modulus operation:|Modulus base:',...
'Mask Translate','md = @1;')
set_param([sys,'/',['Binary vector',13,'lin-blk encode/Modulus',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 vector',13,'lin-blk encode/Modulus',13,'operation']],...
'Mask Entries','2\/',...
'position',[180,26,240,64])
add_block('built-in/Outport',[sys,'/',['Binary vector',13,'lin-blk encode/out_1']])
set_param([sys,'/',['Binary vector',13,'lin-blk encode/out_1']],...
'position',[290,35,310,55])
add_line([sys,'/',['Binary vector',13,'lin-blk encode']],[55,45;105,45])
add_line([sys,'/',['Binary vector',13,'lin-blk encode']],[140,45;175,45])
add_line([sys,'/',['Binary vector',13,'lin-blk encode']],[245,45;285,45])
set_param([sys,'/',['Binary vector',13,'lin-blk encode']],...
'Mask Display','plot(0,0,100,100,x,y);Linear en',...
'Mask Type','Vector I/O linear block encode')
set_param([sys,'/',['Binary vector',13,'lin-blk encode']],...
'Mask Dialogue','Linear block encode with input message\nvector length K and output codeword vector length N.|Generator matrix (binary K-by-N matrix):')
set_param([sys,'/',['Binary vector',13,'lin-blk encode']],...
'Mask Translate','G=@1'';[x,y]=codeicon(1);')
set_param([sys,'/',['Binary vector',13,'lin-blk encode']],...
'Mask Help','Linear block encode with input message vector length K and output codeword vector length N. The generator matrix is a K-by-N matrix. Linear block code is a generic code.')
set_param([sys,'/',['Binary vector',13,'lin-blk encode']],...
'Mask Entries','[[1 1 0; 0 1 1; 1 1 1; 1 0 1] eye(4)]\/')
% Finished composite block ['Binary vector',13,'lin-blk encode'].
set_param([sys,'/',['Binary vector',13,'lin-blk encode']],...
'hide name',0,...
'position',[255,28,335,72])
% Subsystem ['Random-integer',13,'generator1'].
new_system([sys,'/',['Random-integer',13,'generator1']])
set_param([sys,'/',['Random-integer',13,'generator1']],'Location',[98,518,454,687])
add_block('built-in/Outport',[sys,'/',['Random-integer',13,'generator1/out_1']])
set_param([sys,'/',['Random-integer',13,'generator1/out_1']],...
'position',[165,55,185,75])
add_block('built-in/S-Function',[sys,'/',['Random-integer',13,'generator1/Uniform',13,'number']])
set_param([sys,'/',['Random-integer',13,'generator1/Uniform',13,'number']],...
'function name','srandint',...
'parameters','seed,mul',...
'position',[65,45,135,85])
add_line([sys,'/',['Random-integer',13,'generator1']],[140,65;160,65])
set_param([sys,'/',['Random-integer',13,'generator1']],...
'Mask Display','plot(0,0,100,100,x,y);Random int',...
'Mask Type','Random integer generator')
set_param([sys,'/',['Random-integer',13,'generator1']],...
'Mask Dialogue','Generate integers randomly distributed in range [0, M-1], where M is the M-ary number.|M-ary number:|Seed:')
set_param([sys,'/',['Random-integer',13,'generator1']],...
'Mask Translate','seed=@2;mul=@1;[x,y]=srcsicon(4);')
set_param([sys,'/',['Random-integer',13,'generator1']],...
'Mask Help','This block generates an integer number in the range [0 M-1], where M is the M-ary number. The probability of the appearance for each number is equal.')
set_param([sys,'/',['Random-integer',13,'generator1']],...
'Mask Entries','16\/[12345]\/')
% Finished composite block ['Random-integer',13,'generator1'].
set_param([sys,'/',['Random-integer',13,'generator1']],...
'hide name',0,...
'position',[15,28,95,72])
% Subsystem ['Binary vector',13,'noise generator'].
new_system([sys,'/',['Binary vector',13,'noise generator']])
set_param([sys,'/',['Binary vector',13,'noise generator']],'Location',[36,445,326,560])
add_block('built-in/Outport',[sys,'/',['Binary vector',13,'noise generator/out_1']])
set_param([sys,'/',['Binary vector',13,'noise generator/out_1']],...
'position',[190,35,210,55])
add_block('built-in/S-Function',[sys,'/',['Binary vector',13,'noise generator/S-function']])
set_param([sys,'/',['Binary vector',13,'noise generator/S-function']],...
'function name','srandbit',...
'parameters','n, prob, seed',...
'position',[90,35,140,55])
add_line([sys,'/',['Binary vector',13,'noise generator']],[145,45;185,45])
set_param([sys,'/',['Binary vector',13,'noise generator']],...
'Mask Display','plot(0,0,100,100,x,y);B-vector',...
'Mask Type','Binary noise generator')
set_param([sys,'/',['Binary vector',13,'noise generator']],...
'Mask Dialogue','Generate a binary vector with the probability of "1"s in the vector being specified.|Vector length(can''t be changed during simulation):|Probability of a "one", two "ones",three "ones"...:|Seed:')
set_param([sys,'/',['Binary vector',13,'noise generator']],...
'Mask Translate','n=@1;prob=@2;seed=@3;[x,y]=srcsicon(5);')
set_param([sys,'/',['Binary vector',13,'noise generator']],...
'Mask Help','This block outputs a zero vector with "1"s randomly distributed the vector. The maximum number of "1"s in the vector is the same as the length of the vector probability. The value of ith element of the probability is the probability of i number of "1"s in the vector, e.g. [1/4 1/4 1/4] means probability of single "1", double "1"s, three "1"s or no "1" in the vector is 1/4.')
set_param([sys,'/',['Binary vector',13,'noise generator']],...
'Mask Entries','7\/1/2\/12345\/')
% Finished composite block ['Binary vector',13,'noise generator'].
set_param([sys,'/',['Binary vector',13,'noise generator']],...
'hide name',0,...
'position',[115,203,195,247])
add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
'hide name',0,...
'inputs','+',...
'position',[760,215,780,235])
add_block('built-in/Scope',[sys,'/','Error-added'])
set_param([sys,'/','Error-added'],...
'hide name',0,...
'Vgain','1.500000',...
'Hgain','5.000000',...
'Vmax','3.000000',...
'Hmax','10.000000',...
'Window',[335,353,781,621])
open_system([sys,'/','Error-added'])
set_param([sys,'/','Error-added'],...
'position',[805,212,825,238])
add_line(sys,[500,185;520,185])
add_line(sys,[395,185;410,185])
add_line(sys,[340,180;365,180])
add_line(sys,[610,55;630,55])
add_line(sys,[500,55;520,55])
add_line(sys,[100,50;135,50])
add_line(sys,[120,50;120,20;815,20])
add_line(sys,[785,225;800,225])
add_line(sys,[395,55;410,55])
add_line(sys,[340,50;365,50])
add_line(sys,[395,120;410,120])
add_line(sys,[340,115;365,115])
add_line(sys,[500,120;520,120])
add_line(sys,[610,120;630,120])
add_line(sys,[225,50;230,50;230,180;250,180])
add_line(sys,[230,115;250,115])
add_line(sys,[225,50;250,50])
add_line(sys,[610,185;630,185])
add_line(sys,[720,120;745,120])
add_line(sys,[720,55;725,55;725,110;745,110])
add_line(sys,[720,185;725,185;725,130;745,130])
add_line(sys,[790,120;795,120;795,40;815,40])
add_line(sys,[200,225;350,225;350,60;365,60])
add_line(sys,[350,125;365,125])
add_line(sys,[350,190;365,190])
add_line(sys,[350,225;755,225])
drawnow
% Return any arguments.
if (nargin | nargout)
% Must use feval here to access system in memory
if (nargin > 3)
if (flag == 0)
eval(['[ret,x0,str,ts,xts]=',sys,'(t,x,u,flag);'])
else
eval(['ret =', sys,'(t,x,u,flag);'])
end
else
[ret,x0,str,ts,xts] = feval(sys);
end
else
drawnow % Flash up the model and execute load callback
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -