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

📄 com_util.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 5 页
字号:
		'position',[545,45,565,65])

add_block('built-in/Unit Delay',[sys,'/','Mean and std/Unit Delay1'])
set_param([sys,'/','Mean and std/Unit Delay1'],...
		'orientation',2,...
		'Sample time','Ts',...
		'position',[350,87,400,103])

add_block('built-in/Fcn',[sys,'/','Mean and std/Fcn2'])
set_param([sys,'/','Mean and std/Fcn2'],...
		'Expr','u[1]/Ts +1',...
		'position',[105,83,165,107])

add_block('built-in/Digital Clock',[sys,'/','Mean and std/Digital Clock'])
set_param([sys,'/','Mean and std/Digital Clock'],...
		'Sample time','Ts',...
		'position',[45,80,80,110])

add_block('built-in/Inport',[sys,'/','Mean and std/Actual'])
set_param([sys,'/','Mean and std/Actual'],...
		'position',[25,35,45,55])
add_line([sys,'/','Mean and std'],[550,120;550,120])
add_line([sys,'/','Mean and std'],[170,95;190,95;190,150;230,150])
add_line([sys,'/','Mean and std'],[190,125;510,125])
add_line([sys,'/','Mean and std'],[470,55;540,55])
add_line([sys,'/','Mean and std'],[495,55;495,95;405,95])
add_line([sys,'/','Mean and std'],[495,95;495,110;510,110])
add_line([sys,'/','Mean and std'],[625,120;625,140;640,140])
add_line([sys,'/','Mean and std'],[470,150;480,150;480,200;400,200])
add_line([sys,'/','Mean and std'],[480,150;640,150])
add_line([sys,'/','Mean and std'],[670,145;685,145])
add_line([sys,'/','Mean and std'],[50,45;230,45])
add_line([sys,'/','Mean and std'],[200,45;200,140;230,140])
add_line([sys,'/','Mean and std'],[345,95;210,95;210,65;230,65])
add_line([sys,'/','Mean and std'],[190,95;190,55;230,55])
add_line([sys,'/','Mean and std'],[760,145;785,145])
add_line([sys,'/','Mean and std'],[270,55;285,55])
add_line([sys,'/','Mean and std'],[270,150;285,150])
add_line([sys,'/','Mean and std'],[340,200;220,200;230,160])
add_line([sys,'/','Mean and std'],[85,95;100,95])
set_param([sys,'/','Mean and std'],...
		'Mask Display','Mean\n& std',...
		'Mask Type','Running mean and std',...
		'Mask Dialogue','Output the running mean to 1st outport\nand running standard deviation to 2nd outport.|Sample time (sec):')
set_param([sys,'/','Mean and std'],...
		'Mask Translate','Ts=@1;')
set_param([sys,'/','Mean and std'],...
		'Mask Help','This block updates the running mean and standard deviation (std) value at sampling time point. The mean and std are outputted into 1st and 2nd outports respectively.')
set_param([sys,'/','Mean and std'],...
		'Mask Entries','td\/')


%     Finished composite block 'Mean and std'.

set_param([sys,'/','Mean and std'],...
		'position',[335,418,415,462])


%     Subsystem  'Mean and var'.

new_system([sys,'/','Mean and var'])
set_param([sys,'/','Mean and var'],'Location',[16,148,774,399])

add_block('built-in/Inport',[sys,'/','Mean and var/Actual'])
set_param([sys,'/','Mean and var/Actual'],...
		'position',[25,35,45,55])

add_block('built-in/Digital Clock',[sys,'/','Mean and var/Digital Clock'])
set_param([sys,'/','Mean and var/Digital Clock'],...
		'Sample time','Ts',...
		'position',[45,80,80,110])

add_block('built-in/Fcn',[sys,'/','Mean and var/Fcn2'])
set_param([sys,'/','Mean and var/Fcn2'],...
		'Expr','u[1]/Ts +1',...
		'position',[105,83,165,107])

add_block('built-in/Unit Delay',[sys,'/','Mean and var/Unit Delay1'])
set_param([sys,'/','Mean and var/Unit Delay1'],...
		'orientation',2,...
		'Sample time','Ts',...
		'position',[350,87,400,103])

add_block('built-in/Outport',[sys,'/','Mean and var/mean value'])
set_param([sys,'/','Mean and var/mean value'],...
		'position',[545,45,565,65])

add_block('built-in/Mux',[sys,'/','Mean and var/Mux1'])
set_param([sys,'/','Mean and var/Mux1'],...
		'inputs','3',...
		'position',[235,39,265,71])

add_block('built-in/Fcn',[sys,'/','Mean and var/Fcn3'])
set_param([sys,'/','Mean and var/Fcn3'],...
		'Expr','(u[3]*(u[2]-1) + u[1])/u[2]',...
		'position',[290,41,465,69])

add_block('built-in/Mux',[sys,'/','Mean and var/Mux'])
set_param([sys,'/','Mean and var/Mux'],...
		'inputs','3',...
		'position',[235,134,265,166])

add_block('built-in/Unit Delay',[sys,'/','Mean and var/Unit Delay'])
set_param([sys,'/','Mean and var/Unit Delay'],...
		'orientation',2,...
		'Sample time','Ts',...
		'position',[345,192,395,208])

add_block('built-in/Fcn',[sys,'/','Mean and var/Fcn'])
set_param([sys,'/','Mean and var/Fcn'],...
		'Expr','(u[3]*(u[2]-1) + u[1]*u[1])/u[2]',...
		'position',[290,136,465,164])

add_block('built-in/Sum',[sys,'/','Mean and var/Sum'])
set_param([sys,'/','Mean and var/Sum'],...
		'inputs','-+',...
		'position',[645,135,665,155])

add_block('built-in/Mux',[sys,'/','Mean and var/Mux2'])
set_param([sys,'/','Mean and var/Mux2'],...
		'inputs','2',...
		'position',[515,101,545,134])

add_block('built-in/Fcn',[sys,'/','Mean and var/Fcn4'])
set_param([sys,'/','Mean and var/Fcn4'],...
		'Expr','u[1]*u[1]',...
		'position',[555,107,620,133])

add_block('built-in/Outport',[sys,'/',['Mean and var/Mean',13,'Squared',13,'Error1']])
set_param([sys,'/',['Mean and var/Mean',13,'Squared',13,'Error1']],...
		'Port','2',...
		'position',[700,135,720,155])
add_line([sys,'/','Mean and var'],[85,95;100,95])
add_line([sys,'/','Mean and var'],[340,200;220,200;230,160])
add_line([sys,'/','Mean and var'],[170,95;190,95;190,150;230,150])
add_line([sys,'/','Mean and var'],[270,150;285,150])
add_line([sys,'/','Mean and var'],[270,55;285,55])
add_line([sys,'/','Mean and var'],[470,55;540,55])
add_line([sys,'/','Mean and var'],[50,45;230,45])
add_line([sys,'/','Mean and var'],[190,95;190,55;230,55])
add_line([sys,'/','Mean and var'],[495,55;495,95;405,95])
add_line([sys,'/','Mean and var'],[345,95;210,95;210,65;230,65])
add_line([sys,'/','Mean and var'],[200,45;200,140;230,140])
add_line([sys,'/','Mean and var'],[470,150;480,150;480,200;400,200])
add_line([sys,'/','Mean and var'],[480,150;640,150])
add_line([sys,'/','Mean and var'],[625,120;625,140;640,140])
add_line([sys,'/','Mean and var'],[495,95;495,110;510,110])
add_line([sys,'/','Mean and var'],[190,125;510,125])
add_line([sys,'/','Mean and var'],[550,120;550,120])
add_line([sys,'/','Mean and var'],[670,145;695,145])
set_param([sys,'/','Mean and var'],...
		'Mask Display','Mean\n& var',...
		'Mask Type','Running mean and var',...
		'Mask Dialogue','Output the running mean to 1st outport\nand running variant to 2nd outport.|Sample time (sec):')
set_param([sys,'/','Mean and var'],...
		'Mask Translate','Ts=@1;',...
		'Mask Help','This block updates the running mean and variant value at sampling time point. The mean and var values are outputted into 1st and 2nd outports respectively.')
set_param([sys,'/','Mean and var'],...
		'Mask Entries','td\/')


%     Finished composite block 'Mean and var'.

set_param([sys,'/','Mean and var'],...
		'position',[335,493,415,537])

add_block('built-in/S-Function',[sys,'/',['Array',13,'function']])
set_param([sys,'/',['Array',13,'function']],...
		'function name','arysin',...
		'parameters','opr',...
		'Mask Display','Array\nfunction',...
		'Mask Type','Array function')
set_param([sys,'/',['Array',13,'function']],...
		'Mask Dialogue','Array function block for sin, cos, tan, exp, asin, acos, ln, log10, sgn, abs,\nfloor, ceil, and round.|Operation (string):',...
		'Mask Translate','opr=@1;')
set_param([sys,'/',['Array',13,'function']],...
		'Mask Help','This block calculates the given function value. The vector length of the output is the same as the input.',...
		'Mask Entries','''sin''\/',...
		'position',[335,118,415,162])

add_block('built-in/Note',[sys,'/','Utility//Miscellany Library'])
set_param([sys,'/','Utility//Miscellany Library'],...
		'ForeGround',3,...
		'Font Weight','bold',...
		'Font Size',12,...
		'position',[210,6,215,11])


%     Subsystem  'Counter'.

new_system([sys,'/','Counter'])
set_param([sys,'/','Counter'],'Location',[128,50,722,374])


%     Subsystem  ['Counter/Rising edge',13,'detector1'].

new_system([sys,'/',['Counter/Rising edge',13,'detector1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1']],'Location',[303,485,692,659])

add_block('built-in/Outport',[sys,'/',['Counter/Rising edge',13,'detector1/out_1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/out_1']],...
		'position',[340,25,360,45])

add_block('built-in/Relational Operator',[sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator1']],...
		'position',[200,88,230,112])

add_block('built-in/Relational Operator',[sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator2']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator2']],...
		'Operator','>',...
		'position',[265,23,295,47])

add_block('built-in/Constant',[sys,'/',['Counter/Rising edge',13,'detector1/one1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/one1']],...
		'Value','thld',...
		'position',[30,135,60,155])

add_block('built-in/Memory',[sys,'/',['Counter/Rising edge',13,'detector1/Memory1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/Memory1']],...
		'position',[125,80,165,110])

add_block('built-in/Inport',[sys,'/',['Counter/Rising edge',13,'detector1/in_1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/in_1']],...
		'position',[10,15,30,35])

add_block('built-in/Relational Operator',[sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator']],...
		'position',[135,18,165,42])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[35,25;130,25])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[45,25;45,95;120,95])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[170,95;195,95])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[65,145;100,145;100,35;130,35])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[100,145;180,145;180,105;195,105])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[170,30;260,30])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[235,100;240,100;240,40;260,40])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[300,35;335,35])
set_param([sys,'/',['Counter/Rising edge',13,'detector1']],...
		'Mask Display','Edge\ndetector',...
		'Mask Type','Edge Detection',...
		'Mask Dialogue','Rising edge detection:|Threshold:',...
		'Mask Translate','thld=@1;')
set_param([sys,'/',['Counter/Rising edge',13,'detector1']],...
		'Mask Help','When the input signal rising edge passed the given shreshold, this block outputs one, otherwise outputs zero.',...
		'Mask Entries','thld\/')


%     Finished composite block ['Counter/Rising edge',13,'detector1'].

set_param([sys,'/',['Counter/Rising edge',13,'detector1']],...
		'ForeGround',4,...
		'position',[375,53,435,87])

add_block('built-in/Inport',[sys,'/','Counter/in_3'])
set_param([sys,'/','Counter/in_3'],...
		'Port','3',...
		'position',[315,60,335,80])

add_block('built-in/Memory',[sys,'/','Counter/Memory3'])
set_param([sys,'/','Counter/Memory3'],...
		'orientation',2,...
		'ForeGround',3,...
		'position',[400,205,440,235])

add_block('built-in/Switch',[sys,'/','Counter/Switch3'])
set_param([sys,'/','Counter/Switch3'],...
		'ForeGround',3,...
		'Threshold','eps',...
		'position',[470,139,495,171])

add_block('built-in/Outport',[sys,'/','Counter/out_1'])
set_param([sys,'/','Counter/out_1'],...
		'position',[550,145,570,165])


⌨️ 快捷键说明

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