📄 tstlinsq.m
字号:
% Finished composite block ['Binary sequence',13,'lin-blk encode/Register-shift'].
set_param([sys,'/',['Binary sequence',13,'lin-blk encode/Register-shift']],...
'BackGround',3,...
'position',[225,21,280,54])
add_line([sys,'/',['Binary sequence',13,'lin-blk encode']],[505,50;525,50])
add_line([sys,'/',['Binary sequence',13,'lin-blk encode']],[505,35;565,35])
add_line([sys,'/',['Binary sequence',13,'lin-blk encode']],[395,30;435,30])
add_line([sys,'/',['Binary sequence',13,'lin-blk encode']],[285,30;320,30])
add_line([sys,'/',['Binary sequence',13,'lin-blk encode']],[75,30;220,30])
add_line([sys,'/',['Binary sequence',13,'lin-blk encode']],[285,45;300,45;300,80;405,80;405,40;435,40])
add_line([sys,'/',['Binary sequence',13,'lin-blk encode']],[105,95;130,95])
add_line([sys,'/',['Binary sequence',13,'lin-blk encode']],[180,85;190,85;190,45;220,45])
add_line([sys,'/',['Binary sequence',13,'lin-blk encode']],[180,100;415,100;415,50;435,50])
set_param([sys,'/',['Binary sequence',13,'lin-blk encode']],...
'Mask Display','plot(0,0,100,100,x,y,v,w);Linear en',...
'Mask Type','Sequence I/O linear block encode')
set_param([sys,'/',['Binary sequence',13,'lin-blk encode']],...
'Mask Dialogue','Linear block encode with message length K and codeword length N.|Generator matrix (binary K-by-N matrix):|Input sample time T_in (sec):')
set_param([sys,'/',['Binary sequence',13,'lin-blk encode']],...
'Mask Translate','G=@1;samp=@2;[k, n]=size(G);[x,y]=codeicon(3);[v,w]=trigicon(1,75,get_param(gcb,''orientation''));')
set_param([sys,'/',['Binary sequence',13,'lin-blk encode']],...
'Mask Help','This block encodes length K binary message into length N binary codeword using linear block code. The block uses sequential input/output format. The output sequence sample time is K*T_in/N. The block causes a K*T_in delay. The second outport outputs a pulse when Kth message signal is received. The generator matrix is a K-by-N matrix. Linear block code is a generic code.')
set_param([sys,'/',['Binary sequence',13,'lin-blk encode']],...
'Mask Entries','G_lin\/1/size(G_lin,1)\/')
% Finished composite block ['Binary sequence',13,'lin-blk encode'].
set_param([sys,'/',['Binary sequence',13,'lin-blk encode']],...
'hide name',0,...
'position',[165,63,245,107])
% Subsystem ['Sampled read',13,'from wksp'].
new_system([sys,'/',['Sampled read',13,'from wksp']])
set_param([sys,'/',['Sampled read',13,'from wksp']],'Location',[355,528,737,675])
add_block('built-in/S-Function',[sys,'/',['Sampled read',13,'from wksp/Message source']])
set_param([sys,'/',['Sampled read',13,'from wksp/Message source']],...
'BackGround',5,...
'function name','trigwksp',...
'parameters','var,thd,cyclFlag,ini',...
'Mask Display','Triggered\nread',...
'Mask Type','Read from workspace')
set_param([sys,'/',['Sampled read',13,'from wksp/Message source']],...
'Mask Dialogue','The raising edge of input pulse trigger the block output the next row from the workspace variable.|Read the variable:|Threshold for the input pulse:|Cyclic read variable (1) or amend zeros (0).|Output before first trigger:')
set_param([sys,'/',['Sampled read',13,'from wksp/Message source']],...
'Mask Translate','var=@1;thd=@2;cyclFlag=@3;ini=@4;')
set_param([sys,'/',['Sampled read',13,'from wksp/Message source']],...
'Mask Help','This block reads the data from a workspace variable. The output is refreshed at the raising edge of the input pulse.',...
'Mask Entries','var\/.1\/cyc\/ini\/')
set_param([sys,'/',['Sampled read',13,'from wksp/Message source']],...
'position',[180,53,255,97])
add_block('built-in/Outport',[sys,'/',['Sampled read',13,'from wksp/out_1']])
set_param([sys,'/',['Sampled read',13,'from wksp/out_1']],...
'position',[295,65,315,85])
% Subsystem ['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1'].
new_system([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']])
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],'Location',[55,192,283,286])
add_block('built-in/Outport',[sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1/Outport']])
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1/Outport']],...
'position',[160,35,180,55])
add_block('built-in/S-Function',[sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1/S-function1']])
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1/S-function1']],...
'function name','homopuls',...
'parameters','samp_time, out_divid, offset',...
'position',[40,31,105,59])
add_line([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],[110,45;155,45])
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'Mask Display','Vector\nPulse',...
'Mask Type','Pulse generator')
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'Mask Dialogue','Vector pulses with sample rate of each pulse as Sample_time ./Divider. |Sample time (scalar, sec):|Divider (integer vector):|Offset (have same dimension as Divider:')
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'Mask Translate','samp_time=@1;out_divid=@2;offset=@3;')
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'Mask Help','This block generator a vector pulses. The output length is the same as the vector defined in "Divider". The ith element of the output has the sample time Sample_time/Divider(i). All elements in "Divider" must be integers.')
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'Mask Entries','ts\/1\/off\/')
% Finished composite block ['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1'].
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'position',[50,56,110,94])
add_line([sys,'/',['Sampled read',13,'from wksp']],[115,75;175,75])
add_line([sys,'/',['Sampled read',13,'from wksp']],[260,75;290,75])
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'Mask Display','plot(0,0,100,100,x,y);Rd wksp',...
'Mask Type','Read from workspace')
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'Mask Dialogue','Read from a workspace variable at\nsampling time point.|Variable (column_number=block_output_length):|Data output sample time (sec):|Cyclic control (1: cyclic read, 0: output zeros after eof).|Initial output:')
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'Mask Translate','var=@1;td=@2;ts=td(1);if (length(td)>=2),off=td(2);else off=0;end;cyc=@3;ini=@4;[x,y]=srcsicon(7);')
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'Mask Help','This block reads from a workspace variable at a given sample time. The column number is the block output vector length. When the simulation reached the end of the variable (eof) row, the block will cyclically output from the first row of the variable or output zeros based on the cyclic control entree.')
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'Mask Entries','randint(200,1)\/1/size(G_lin,1)\/1\/0\/')
% Finished composite block ['Sampled read',13,'from wksp'].
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'hide name',0,...
'position',[25,63,105,107])
% Subsystem ['Binary error',13,'channel'].
new_system([sys,'/',['Binary error',13,'channel']])
set_param([sys,'/',['Binary error',13,'channel']],'Location',[259,203,738,408])
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','.02\/1\/')
% Finished composite block ['Binary error',13,'channel'].
set_param([sys,'/',['Binary error',13,'channel']],...
'hide name',0,...
'position',[270,53,350,97])
add_block('built-in/Note',[sys,'/','In this demo, generator matrix is G_lin=[1 0 1 1;1 1 1 0;0 1 1 1;eye(4)]; trt=0;'])
set_param([sys,'/','In this demo, generator matrix is G_lin=[1 0 1 1;1 1 1 0;0 1 1 1;eye(4)]; trt=0;'],...
'position',[245,155,250,160])
add_line(sys,[465,120;500,120])
add_line(sys,[355,85;360,85;360,105;375,105])
add_line(sys,[360,105;360,120;375,120])
add_line(sys,[110,85;160,85])
add_line(sys,[130,85;130,35;500,35])
add_line(sys,[465,65;480,65;480,55;500,55])
add_line(sys,[355,65;375,65])
add_line(sys,[
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -