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

📄 com_util.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 5 页
字号:
%     Subsystem  ['Counter/Rising edge',13,'detector'].

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

add_block('built-in/Relational Operator',[sys,'/',['Counter/Rising edge',13,'detector/Relational',13,'Operator']])
set_param([sys,'/',['Counter/Rising edge',13,'detector/Relational',13,'Operator']],...
		'position',[135,18,165,42])

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

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

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

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

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

add_block('built-in/Outport',[sys,'/',['Counter/Rising edge',13,'detector/out_1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector/out_1']],...
		'position',[340,25,360,45])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[300,35;335,35])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[235,100;240,100;240,40;260,40])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[170,30;260,30])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[65,145;100,145;100,35;130,35])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[100,145;180,145;180,105;195,105])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[170,95;195,95])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[35,25;130,25])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[45,25;45,95;120,95])
set_param([sys,'/',['Counter/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,'/',['Counter/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','thld\/')


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

set_param([sys,'/',['Counter/Rising edge',13,'detector']],...
		'ForeGround',4,...
		'position',[80,148,140,182])

add_block('built-in/Inport',[sys,'/','Counter/in_2'])
set_param([sys,'/','Counter/in_2'],...
		'Port','2',...
		'position',[15,155,35,175])

add_block('built-in/Inport',[sys,'/','Counter/in_1'])
set_param([sys,'/','Counter/in_1'],...
		'position',[15,50,35,70])

add_block('built-in/Switch',[sys,'/','Counter/Switch2'])
set_param([sys,'/','Counter/Switch2'],...
		'ForeGround',3,...
		'Threshold','eps',...
		'position',[345,149,370,181])

add_block('built-in/Sum',[sys,'/','Counter/Sum'])
set_param([sys,'/','Counter/Sum'],...
		'ForeGround',3,...
		'position',[295,100,315,120])

add_block('built-in/Relational Operator',[sys,'/',['Counter/Relational',13,'Operator1']])
set_param([sys,'/',['Counter/Relational',13,'Operator1']],...
		'ForeGround',2,...
		'Operator','>',...
		'position',[225,53,255,77])

add_block('built-in/Constant',[sys,'/','Counter/Constant'])
set_param([sys,'/','Counter/Constant'],...
		'ForeGround',3,...
		'Value','thld',...
		'position',[105,100,135,120])
add_line([sys,'/','Counter'],[500,155;545,155])
add_line([sys,'/','Counter'],[520,155;520,220;445,220])
add_line([sys,'/','Counter'],[375,165;465,165])
add_line([sys,'/','Counter'],[340,70;370,70])
add_line([sys,'/','Counter'],[40,165;75,165])
add_line([sys,'/','Counter'],[40,60;220,60])
add_line([sys,'/','Counter'],[320,110;330,110;340,155])
add_line([sys,'/','Counter'],[395,220;275,220;275,175;340,175])
add_line([sys,'/','Counter'],[140,110;190,110;190,70;220,70])
add_line([sys,'/','Counter'],[260,65;275,65;275,105;290,105])
add_line([sys,'/','Counter'],[145,165;340,165])
add_line([sys,'/','Counter'],[275,175;275,115;290,115])
add_line([sys,'/','Counter'],[440,70;450,70;450,155;465,155])
set_param([sys,'/','Counter'],...
		'Mask Display','plot(0,0,100,100,x,y,v,w);Counter',...
		'Mask Type','Resettable number counter')
set_param([sys,'/','Counter'],...
		'Mask Dialogue','If the 1st inport value is larger than the threshold, the counter increases one at the rising edge of the 2nd inport pulse.|Threshold:')
set_param([sys,'/','Counter'],...
		'Mask Translate','thld=@1;[v,w]=trigicon(0,50,get_param(gcb,''orientation''),2);[x,y]=trigicon(0,20,get_param(gcb,''orientation''),2);')
set_param([sys,'/','Counter'],...
		'Mask Help','If the signal at the 1st inport is larger than or equal to the given threshold at the rising edge of the 2nd inport, the counter increases by one. The rising edge of the 3rd port resets the counter to zero.')
set_param([sys,'/','Counter'],...
		'Mask Entries','.2\/')


%     Finished composite block 'Counter'.

set_param([sys,'/','Counter'],...
		'position',[180,353,260,397])


%     Subsystem  ['Modulo',13,'integrator'].

new_system([sys,'/',['Modulo',13,'integrator']])
set_param([sys,'/',['Modulo',13,'integrator']],'Location',[196,490,621,627])

add_block('built-in/Inport',[sys,'/',['Modulo',13,'integrator/in_1']])
set_param([sys,'/',['Modulo',13,'integrator/in_1']],...
		'position',[35,15,55,35])

add_block('built-in/Memory',[sys,'/',['Modulo',13,'integrator/Memory']])
set_param([sys,'/',['Modulo',13,'integrator/Memory']],...
		'orientation',2,...
		'x0','init',...
		'position',[210,75,260,105])

add_block('built-in/Fcn',[sys,'/',['Modulo',13,'integrator/module']])
set_param([sys,'/',['Modulo',13,'integrator/module']],...
		'Expr','rem(u[1],modu)',...
		'position',[235,29,325,51])

add_block('built-in/Reset Integrator',[sys,'/',['Modulo',13,'integrator/Reset',13,'integrator']])
set_param([sys,'/',['Modulo',13,'integrator/Reset',13,'integrator']],...
		'position',[110,19,150,51])

add_block('built-in/Constant',[sys,'/',['Modulo',13,'integrator/one']])
set_param([sys,'/',['Modulo',13,'integrator/one']],...
		'orientation',3,...
		'move name',0,...
		'position',[70,55,90,75])

add_block('built-in/Sum',[sys,'/',['Modulo',13,'integrator/Sum']])
set_param([sys,'/',['Modulo',13,'integrator/Sum']],...
		'position',[195,30,215,50])

add_block('built-in/Outport',[sys,'/',['Modulo',13,'integrator/out_1']])
set_param([sys,'/',['Modulo',13,'integrator/out_1']],...
		'position',[370,30,390,50])
add_line([sys,'/',['Modulo',13,'integrator']],[205,90;180,90;190,45])
add_line([sys,'/',['Modulo',13,'integrator']],[155,35;190,35])
add_line([sys,'/',['Modulo',13,'integrator']],[220,40;230,40])
add_line([sys,'/',['Modulo',13,'integrator']],[330,40;365,40])
add_line([sys,'/',['Modulo',13,'integrator']],[60,25;105,25])
add_line([sys,'/',['Modulo',13,'integrator']],[80,50;80,35;105,35])
add_line([sys,'/',['Modulo',13,'integrator']],[340,40;340,90;265,90])
set_param([sys,'/',['Modulo',13,'integrator']],...
		'Mask Display','Modulo\nintegrator',...
		'Mask Type','Modulo integrator')
set_param([sys,'/',['Modulo',13,'integrator']],...
		'Mask Dialogue','When the absolute value of the state\nexceeds the modulo bound, the state is\nreset to be the remainder of the state\ndivided by the modulo bound.|Modulo bound:|Initial state:')
set_param([sys,'/',['Modulo',13,'integrator']],...
		'Mask Translate','init=@2;modu=@1;')
set_param([sys,'/',['Modulo',13,'integrator']],...
		'Mask Help','This block calculate the integration of the input signal. The absolute value of this integrator will not exceed the specified module bound. The state value is reset to be the remainder of the state divided by the modulo bound. This block can only be used for scale value calculation. This block is a continuous-time integration block.')
set_param([sys,'/',['Modulo',13,'integrator']],...
		'Mask Entries','1\/0\/')


%     Finished composite block ['Modulo',13,'integrator'].

set_param([sys,'/',['Modulo',13,'integrator']],...
		'position',[30,118,110,162])


%     Subsystem  'Signal switch'.

new_system([sys,'/','Signal switch'])
set_param([sys,'/','Signal switch'],'Location',[174,522,554,686])

add_block('built-in/Inport',[sys,'/','Signal switch/in_1'])
set_param([sys,'/','Signal switch/in_1'],...
		'position',[65,20,85,40])

add_block('built-in/Mux',[sys,'/','Signal switch/Mux'])
set_param([sys,'/','Signal switch/Mux'],...
		'inputs','2',...
		'position',[145,54,175,96])

add_block('built-in/Outport',[sys,'/','Signal switch/out_1'])
set_param([sys,'/','Signal switch/out_1'],...
		'position',[320,65,340,85])

add_block('built-in/Inport',[sys,'/','Signal switch/in_2'])
set_param([sys,'/','Signal switch/in_2'],...
		'Port','2',...
		'position',[60,75,80,95])

add_block('built-in/S-Function',[sys,'/','Signal switch/S-function'])
set_param([sys,'/','Signal switch/S-function'],...
		'function name','switchbx',...
		'parameters','sw,df',...
		'position',[205,60,275,90])
add_line([sys,'/','Signal switch'],[90,30;120,30;120,65;140,65])
add_line([sys,'/','Signal switch'],[85,85;140,85])
add_line([sys,'/','Signal switch'],[180,75;200,75])
add_line([sys,'/','Signal switch'],[280,75;315,75])
set_param([sys,'/','Signal switch'],...
		'Mask Display','Switch\nbox',...
		'Mask Type','Vector signal re-distribution')
set_param([sys,'/','Signal switch'],...
		'Mask Dialogue','The output distribution pattern follows the ith row of the switch box, where i is the input from the second port.|Switch box (column number equals block output length):|Default value:')
set_param([sys,'/','Signal switch'],...
		'Mask Translate','sw=@1;df=@2;')
set_param([sys,'/','Signal switch'],...
		'Mask Help','This block follows the switch pattern of ith row in the switch box when the second input port has value i.  When the value in the second input is larger than the switch box row number or less than 1, the block outputs the defualt value.')
set_param([sys,'/','Signal switch'],...
		'Mask Entries','[1 2;2 3;3 1]\/[0 0]\/')


%     Finished composite block 'Signal switch'.

set_param([sys,'/','Signal switch'],...
		'position',[30,643,110,687])


%     Subsystem  ['Triggered',13,'signal switch'].

new_system([sys,'/',['Triggered',13,'signal switch']])
set_param([sys,'/',['Triggered',13,'signal switch']],'Location',[624,516,1004,680])

add_block('built-in/Inport',[sys,'/',['Triggered',13,'signal switch/in_1']])
set_param([sys,'/',['Triggered',13,'signal switch/in_1']],...
		'position',[65,20,85,40])

add_block('built-in/Mux',[sys,'/',['Triggered',13,'signal switch/Mux']])
set_param([sys,'/',['Triggered',13,'signal switch/Mux']],...
		'inputs','2',...
		'position',[145,54,175,96])

add_block('built-in/Outport',[sys,'/',['Triggered',13,'signal switch/out_1']])
set_param([sys,'/',['Triggered',13,'signal switch/out_1']],...
		'position',[320,65,340,85])

add_block('built-in/Inport',[sys,'/',['Triggered',13,'signal switch/in_2']])
set_param([sys,'/',['Triggered',13,'signal switch/in_2']],...
		'Port','2',...
		'position',[60,75,80,95])

add_block('built-in/S-Function',[sys,'/',['Triggered',13,'signal switch/S-function']])
set_param([sys,'/',['Triggered',13,'signal switch/S-function']],...
		'function name','stdmamux',...
		'parameters','sw,ke,in,tt',...
		'position',[205,60,275,90])
add_line([sys,'/',['Triggered',13,'signal switch']],[90,30;120,30;120,65;140,65])
add_line([sys,'/',['Triggered',13,'signal switch']],[85,85;140,85])
add_line([sys,'/',['Triggered',13,'signal switch']],[180,75;200,75])
add_line([sys,'/',['Triggered',13,'signal switch']],[280,75;315,75])
set_param([sys,'/',['Triggered',13,'signal switch']],...
		'Mask Display','plot(0,0,100,100,v,w);Vct re-arr',...
		'Mask Type','Vector signal re-distribution')
set_param([sys,'/',['Triggered',13,'signal switch']],...
		'Mask Dialogue','The rising edge from the 2nd inport\ntriggers the output of this block to follow the rule of the next row in the switch box.|Switch box (column number equals block output length):|Keeping valu

⌨️ 快捷键说明

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