📄 tstbchsq.m
字号:
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])
% 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'],[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'],[395,220;275,220;275,175;340,175])
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','.6\/')
% Finished composite block 'Counter'.
set_param([sys,'/','Counter'],...
'hide name',0,...
'position',[390,138,470,182])
% Subsystem ['K-step',13,'delay'].
new_system([sys,'/',['K-step',13,'delay']])
set_param([sys,'/',['K-step',13,'delay']],'Location',[12,432,357,702])
add_block('built-in/Digital Clock',[sys,'/',['K-step',13,'delay/Digital Clock']])
set_param([sys,'/',['K-step',13,'delay/Digital Clock']],...
'Sample time','ts',...
'position',[60,140,95,170])
add_block('built-in/Inport',[sys,'/',['K-step',13,'delay/in_1']])
set_param([sys,'/',['K-step',13,'delay/in_1']],...
'position',[20,80,40,100])
add_block('built-in/Outport',[sys,'/',['K-step',13,'delay/out_1']])
set_param([sys,'/',['K-step',13,'delay/out_1']],...
'position',[325,120,345,140])
add_block('built-in/Filter',[sys,'/',['K-step',13,'delay/K-step',13,'delay']])
set_param([sys,'/',['K-step',13,'delay/K-step',13,'delay']],...
'Numerator','[zeros(1,n), 1]',...
'Denominator','1',...
'Sample time','ts',...
'position',[60,70,185,110])
add_block('built-in/Switch',[sys,'/',['K-step',13,'delay/Switch']])
set_param([sys,'/',['K-step',13,'delay/Switch']],...
'Threshold','.1',...
'position',[270,114,295,146])
add_block('built-in/Constant',[sys,'/',['K-step',13,'delay/Constant']])
set_param([sys,'/',['K-step',13,'delay/Constant']],...
'Value','ini',...
'position',[120,230,140,250])
add_block('built-in/Constant',[sys,'/',['K-step',13,'delay/Constant1']])
set_param([sys,'/',['K-step',13,'delay/Constant1']],...
'Value','n*ts(1)+ts(2)',...
'position',[15,194,100,216])
add_block('built-in/Relational Operator',[sys,'/',['K-step',13,'delay/Relational',13,'Operator']])
set_param([sys,'/',['K-step',13,'delay/Relational',13,'Operator']],...
'position',[150,168,180,192])
add_line([sys,'/',['K-step',13,'delay']],[300,130;320,130])
add_line([sys,'/',['K-step',13,'delay']],[45,90;55,90])
add_line([sys,'/',['K-step',13,'delay']],[190,90;195,90;195,120;265,120])
add_line([sys,'/',['K-step',13,'delay']],[145,240;240,240;240,140;265,140])
add_line([sys,'/',['K-step',13,'delay']],[100,155;115,155;115,175;145,175])
add_line([sys,'/',['K-step',13,'delay']],[105,205;115,205;115,185;145,185])
add_line([sys,'/',['K-step',13,'delay']],[185,180;220,180;220,130;265,130])
set_param([sys,'/',['K-step',13,'delay']],...
'Mask Display',' -k\nz ',...
'Mask Type','Multi-step delay',...
'Mask Dialogue','Output is K-step delay of the input signal.|Delay steps (integer):|Sample time (sec):|Initial output:')
set_param([sys,'/',['K-step',13,'delay']],...
'Mask Translate','n=@1;ts=@2;if length(ts)<2, ts=[ts 0];end;ini=@3;')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -