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

📄 tstconcd.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 3 页
字号:

add_block('built-in/Relational Operator',[sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/Relational',13,'Operator1']])
set_param([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/Relational',13,'Operator1']],...
		'position',[200,88,230,112])

add_block('built-in/Outport',[sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/out_1']])
set_param([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector/out_1']],...
		'position',[340,25,360,45])
add_line([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],[300,35;335,35])
add_line([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],[235,100;240,100;240,40;260,40])
add_line([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],[170,30;260,30])
add_line([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],[65,145;100,145;100,35;130,35])
add_line([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],[100,145;180,145;180,105;195,105])
add_line([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],[170,95;195,95])
add_line([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],[35,25;130,25])
add_line([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],[45,25;45,95;120,95])
set_param([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],...
		'Mask Display','Edge\nDetector',...
		'Mask Type','Edge Detection',...
		'Mask Dialogue','Rising edge detection:|Threshold:',...
		'Mask Translate','thld=@1;')
set_param([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],...
		'Mask Help','When the input signal rising edge passed the given shreshold, this block outputs one, otherwise outputs zero.',...
		'Mask Entries','thd\/')


%     Finished composite block ['Binary vector',13,'convol encode/Rising edge',13,'detector'].

set_param([sys,'/',['Binary vector',13,'convol encode/Rising edge',13,'detector']],...
		'position',[125,147,180,183])

add_block('built-in/Mux',[sys,'/',['Binary vector',13,'convol encode/Mux']])
set_param([sys,'/',['Binary vector',13,'convol encode/Mux']],...
		'inputs','2',...
		'Mask Display','',...
		'position',[220,71,255,104])

add_block('built-in/S-Function',[sys,'/',['Binary vector',13,'convol encode/Modulo',13,'operation1']])
set_param([sys,'/',['Binary vector',13,'convol encode/Modulo',13,'operation1']],...
		'function name','sconvenc',...
		'parameters','tf',...
		'position',[285,75,345,105])

add_block('built-in/Inport',[sys,'/',['Binary vector',13,'convol encode/in_2']])
set_param([sys,'/',['Binary vector',13,'convol encode/in_2']],...
		'Port','2',...
		'position',[40,155,60,175])

add_block('built-in/Outport',[sys,'/',['Binary vector',13,'convol encode/out_1']])
set_param([sys,'/',['Binary vector',13,'convol encode/out_1']],...
		'position',[380,80,400,100])
add_line([sys,'/',['Binary vector',13,'convol encode']],[260,90;280,90])
add_line([sys,'/',['Binary vector',13,'convol encode']],[185,165;190,165;190,95;215,95])
add_line([sys,'/',['Binary vector',13,'convol encode']],[65,165;120,165])
add_line([sys,'/',['Binary vector',13,'convol encode']],[50,70;125,70;125,80;215,80])
add_line([sys,'/',['Binary vector',13,'convol encode']],[350,90;375,90])
set_param([sys,'/',['Binary vector',13,'convol encode']],...
		'Mask Display','plot(0,0,100,100,x,y,v,w);Convl en',...
		'Mask Type','Vector I/O convolution encode')
set_param([sys,'/',['Binary vector',13,'convol encode']],...
		'Mask Dialogue','Convolution encode with codeword length\nN and message length K. Transfer function\nmatrix is a K-by-N matrix.|Transfer function (or SIMULINK diagram):|Trigger signal threshold:')
set_param([sys,'/',['Binary vector',13,'convol encode']],...
		'Mask Translate','tf=@1;tf=simviter(tf);thd=@2;[x,y]=codeicon(1);[v,w]=trigicon(0,25,get_param(gcb,''orientation''),2);')
set_param([sys,'/',['Binary vector',13,'convol encode']],...
		'Mask Help','This block encodes length K binary vector message input into length N binary vector codeword output using convolution code. The block refreshes its register memory and output at the rising edge of the second inport pulse. You can also use a SIMULINK block diagram to define the convolution code transfer function.')
set_param([sys,'/',['Binary vector',13,'convol encode']],...
		'Mask Entries','tf\/.5\/')


%     Finished composite block ['Binary vector',13,'convol encode'].

set_param([sys,'/',['Binary vector',13,'convol encode']],...
		'hide name',0,...
		'position',[230,53,310,97])

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','K_con_demo\/2\/',...
		'position',[115,43,195,87])


%     Subsystem  'Error rate1'.

new_system([sys,'/','Error rate1'])
set_param([sys,'/','Error rate1'],'Location',[255,368,509,510])

add_block('built-in/S-Function',[sys,'/','Error rate1/S-function'])
set_param([sys,'/','Error rate1/S-function'],...
		'function name','sbiterr',...
		'parameters','num_lin, K, TDelay, Sample',...
		'position',[130,52,195,78])

add_block('built-in/Mux',[sys,'/','Error rate1/Mux'])
set_param([sys,'/','Error rate1/Mux'],...
		'inputs','2',...
		'position',[65,46,100,79])

add_block('built-in/Inport',[sys,'/','Error rate1/in_1'])
set_param([sys,'/','Error rate1/in_1'],...
		'position',[15,45,35,65])

add_block('built-in/Inport',[sys,'/','Error rate1/in_2'])
set_param([sys,'/','Error rate1/in_2'],...
		'Port','2',...
		'position',[15,60,35,80])
add_line([sys,'/','Error rate1'],[105,65;125,65])
add_line([sys,'/','Error rate1'],[40,55;60,55])
add_line([sys,'/','Error rate1'],[40,70;60,70])
set_param([sys,'/','Error rate1'],...
		'Mask Display','Error\nmeter',...
		'Mask Type','Symbol/bit error counter')
set_param([sys,'/','Error rate1'],...
		'Mask Dialogue','Use the input data from the 1st port as the reference signal to detect the number of errors and error rate of the 2nd port inputted signal.|Bit per symbol:|Number of digits on display:|Delay between input (1st port) and output (2nd port):|Sampling time (sec):')
set_param([sys,'/','Error rate1'],...
		'Mask Translate','K=@1;num_lin=@2;TDelay=@3;Sample=@4;')
set_param([sys,'/','Error rate1'],...
		'Mask Help','The signal from the first port must be a scalar. The second input port can be a vector with a same-time delay to the input signal. The comparison happens only at the sampling point.')
set_param([sys,'/','Error rate1'],...
		'Mask Entries','tf(2,size(tf,2))\/20\/10\/1\/')


%     Finished composite block 'Error rate1'.

set_param([sys,'/','Error rate1'],...
		'hide name',0,...
		'position',[680,33,760,77])


%     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])

add_block('built-in/S-Function',[sys,'/',['Sampled read with',13,'synchronized pulse/Message source']])
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/Message source']],...
		'BackGround',5,...
		'function name','trigwksp',...
		'parameters','var,thd,cyclFlag,ini',...
		'Mask Display','Triggered\nread')
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/Message source']],...
		'Mask Type','Read from workspace')
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/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 with',13,'synchronized pulse/Message source']],...
		'Mask Translate','var=@1;thd=@2;cyclFlag=@3;ini=@4;')
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/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.')
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/Message source']],...
		'Mask Entries','var\/.1\/cyc\/ini\/',...
		'position',[180,53,255,97])

add_block('built-in/Outport',[sys,'/',['Sampled read with',13,'synchronized pulse/out_2']])
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/out_2']],...
		'Port','2',...
		'position',[195,115,215,135])

add_block('built-in/Outport',[sys,'/',['Sampled read with',13,'synchronized pulse/out_1']])
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/out_1']],...
		'position',[295,65,315,85])


%     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/Outport',[sys,'/',['Sampled read with',13,'synchronized pulse/Pulses deivide',13,'same sample time1/Outport']])
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/Pulses deivide',13,'same sample time1/Outport']],...
		'position',[160,35,180,55])

add_block('built-in/S-Function',[sys,'/',['Sampled read with',13,'synchronized pulse/Pulses deivide',13,'same sample time1/S-function1']])
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/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 with',13,'synchronized pulse/Pulses deivide',13,'same sample time1']],[110,45;155,45])
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/Pulses deivide',13,'same sample time1']],...
		'Mask Display','Vector\nPulse',...
		'Mask Type','Pulse generator')
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/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 with',13,'synchronized pulse/Pulses deivide',13,'same sample time1']],...
		'Mask Translate','samp_time=@1;out_divid=@2;offset=@3;')
set_param([sys,'/',['Sampled read with',13,'synchronized pulse/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 with',13,'synchronized pulse/Pulses deivide',13,'same sample time1']],...
		'Mask Entries','ts\/1\/off\/')


%     Finished composite block ['Sampled read with',13,'synchronized pulse/Pulses deivide',13,'same sample time1'].

⌨️ 快捷键说明

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