📄 com_util.m
字号:
set_param([sys,'/',['Envelope',13,'detector']],'Location',[86,374,853,617])
add_block('built-in/Memory',[sys,'/',['Envelope',13,'detector/Memory1']])
set_param([sys,'/',['Envelope',13,'detector/Memory1']],...
'position',[285,125,325,155])
add_block('built-in/Inport',[sys,'/',['Envelope',13,'detector/in_1']])
set_param([sys,'/',['Envelope',13,'detector/in_1']],...
'position',[30,100,50,120])
add_block('built-in/Gain',[sys,'/',['Envelope',13,'detector/Gain']])
set_param([sys,'/',['Envelope',13,'detector/Gain']],...
'Gain','g',...
'position',[75,100,95,120])
add_block('built-in/Memory',[sys,'/',['Envelope',13,'detector/Memory']])
set_param([sys,'/',['Envelope',13,'detector/Memory']],...
'position',[120,35,160,65])
add_block('built-in/Relational Operator',[sys,'/',['Envelope',13,'detector/Relational',13,'Operator']])
set_param([sys,'/',['Envelope',13,'detector/Relational',13,'Operator']],...
'position',[210,93,240,117])
add_block('built-in/Relational Operator',[sys,'/',['Envelope',13,'detector/Relational',13,'Operator1']])
set_param([sys,'/',['Envelope',13,'detector/Relational',13,'Operator1']],...
'Operator','>',...
'position',[345,98,375,122])
add_block('built-in/Switch',[sys,'/',['Envelope',13,'detector/Switch']])
set_param([sys,'/',['Envelope',13,'detector/Switch']],...
'Threshold','eps',...
'position',[420,94,445,126])
add_block('built-in/Memory',[sys,'/',['Envelope',13,'detector/Memory2']])
set_param([sys,'/',['Envelope',13,'detector/Memory2']],...
'orientation',2,...
'position',[410,155,450,185])
add_block('built-in/Switch',[sys,'/',['Envelope',13,'detector/Switch1']])
set_param([sys,'/',['Envelope',13,'detector/Switch1']],...
'Threshold','eps',...
'position',[575,99,600,131])
add_block('built-in/Gain',[sys,'/',['Envelope',13,'detector/Gain1']])
set_param([sys,'/',['Envelope',13,'detector/Gain1']],...
'Gain','g',...
'position',[635,105,655,125])
add_block('built-in/Outport',[sys,'/',['Envelope',13,'detector/out_1']])
set_param([sys,'/',['Envelope',13,'detector/out_1']],...
'position',[690,105,710,125])
add_block('built-in/Relational Operator',[sys,'/',['Envelope',13,'detector/Relational',13,'Operator2']])
set_param([sys,'/',['Envelope',13,'detector/Relational',13,'Operator2']],...
'position',[495,103,525,127])
add_line([sys,'/',['Envelope',13,'detector']],[660,115;685,115])
add_line([sys,'/',['Envelope',13,'detector']],[100,110;105,110;115,50])
add_line([sys,'/',['Envelope',13,'detector']],[100,110;205,110])
add_line([sys,'/',['Envelope',13,'detector']],[55,110;70,110])
add_line([sys,'/',['Envelope',13,'detector']],[405,170;395,170;395,120;415,120])
add_line([sys,'/',['Envelope',13,'detector']],[380,110;415,110])
add_line([sys,'/',['Envelope',13,'detector']],[245,105;270,105;280,140])
add_line([sys,'/',['Envelope',13,'detector']],[270,105;340,105])
add_line([sys,'/',['Envelope',13,'detector']],[330,140;340,115])
add_line([sys,'/',['Envelope',13,'detector']],[165,50;195,50;205,100])
add_line([sys,'/',['Envelope',13,'detector']],[195,50;395,50;395,100;415,100])
add_line([sys,'/',['Envelope',13,'detector']],[450,110;470,110;470,170;455,170])
add_line([sys,'/',['Envelope',13,'detector']],[605,115;630,115])
add_line([sys,'/',['Envelope',13,'detector']],[470,110;490,110])
add_line([sys,'/',['Envelope',13,'detector']],[530,115;570,115])
add_line([sys,'/',['Envelope',13,'detector']],[470,110;470,85;550,85;550,105;570,105])
set_param([sys,'/',['Envelope',13,'detector']],...
'Mask Display','Envelope\ndetector',...
'Mask Type','Envelope detector',...
'Mask Dialogue','Output the upper or lower boundary of\nthe input signal.|Boundary side (''upper'' or ''lower''):')
set_param([sys,'/',['Envelope',13,'detector']],...
'Mask Translate','x=@1;if length(x)<2, error(''Error in Envelop Detector'');end;x=x(1:2);g=1;if x==''lo'', g=-1;end;')
set_param([sys,'/',['Envelope',13,'detector']],...
'Mask Help','This block detects the upper or lower boundary of the envelope of the input signal. This block finds the maximum or minimum value of the input signal. The block is noise sensitive.')
set_param([sys,'/',['Envelope',13,'detector']],...
'Mask Entries','''upper''\/')
% Finished composite block ['Envelope',13,'detector'].
set_param([sys,'/',['Envelope',13,'detector']],...
'position',[175,193,255,237])
% Subsystem ['Rising edge',13,'detector'].
new_system([sys,'/',['Rising edge',13,'detector']])
set_param([sys,'/',['Rising edge',13,'detector']],'Location',[282,116,671,290])
add_block('built-in/Relational Operator',[sys,'/',['Rising edge',13,'detector/Relational',13,'Operator']])
set_param([sys,'/',['Rising edge',13,'detector/Relational',13,'Operator']],...
'position',[135,18,165,42])
add_block('built-in/Inport',[sys,'/',['Rising edge',13,'detector/in_1']])
set_param([sys,'/',['Rising edge',13,'detector/in_1']],...
'position',[10,15,30,35])
add_block('built-in/Memory',[sys,'/',['Rising edge',13,'detector/Memory1']])
set_param([sys,'/',['Rising edge',13,'detector/Memory1']],...
'position',[125,80,165,110])
add_block('built-in/Constant',[sys,'/',['Rising edge',13,'detector/one1']])
set_param([sys,'/',['Rising edge',13,'detector/one1']],...
'Value','thld',...
'position',[30,135,60,155])
add_block('built-in/Relational Operator',[sys,'/',['Rising edge',13,'detector/Relational',13,'Operator2']])
set_param([sys,'/',['Rising edge',13,'detector/Relational',13,'Operator2']],...
'Operator','>',...
'position',[265,23,295,47])
add_block('built-in/Relational Operator',[sys,'/',['Rising edge',13,'detector/Relational',13,'Operator1']])
set_param([sys,'/',['Rising edge',13,'detector/Relational',13,'Operator1']],...
'position',[200,88,230,112])
add_block('built-in/Outport',[sys,'/',['Rising edge',13,'detector/out_1']])
set_param([sys,'/',['Rising edge',13,'detector/out_1']],...
'position',[340,25,360,45])
add_line([sys,'/',['Rising edge',13,'detector']],[300,35;335,35])
add_line([sys,'/',['Rising edge',13,'detector']],[235,100;240,100;240,40;260,40])
add_line([sys,'/',['Rising edge',13,'detector']],[170,30;260,30])
add_line([sys,'/',['Rising edge',13,'detector']],[65,145;100,145;100,35;130,35])
add_line([sys,'/',['Rising edge',13,'detector']],[100,145;180,145;180,105;195,105])
add_line([sys,'/',['Rising edge',13,'detector']],[170,95;195,95])
add_line([sys,'/',['Rising edge',13,'detector']],[35,25;130,25])
add_line([sys,'/',['Rising edge',13,'detector']],[45,25;45,95;120,95])
set_param([sys,'/',['Rising edge',13,'detector']],...
'Mask Display','plot(0,0,100,100,x,y,v,w);Edge det.',...
'Mask Type','Edge detection')
set_param([sys,'/',['Rising edge',13,'detector']],...
'Mask Dialogue','Detect the rising edge of the input\nsignal. Output one when the rising\nedge is detected.|Threshold:')
set_param([sys,'/',['Rising edge',13,'detector']],...
'Mask Translate','thld=@1;[v,w]=trigicon(0,50,get_param(gcb,''orientation''),2);[x,y]=trigicon(1,50,get_param(gcb,''orientation''));')
set_param([sys,'/',['Rising edge',13,'detector']],...
'Mask Help','This block outputs one when the input signal reaches a value larger than or equal to the given threshold value at the current time and the value was below the threshold one time step before. Otherwise, the block outputs zero.')
set_param([sys,'/',['Rising edge',13,'detector']],...
'Mask Entries','0.5\/')
% Finished composite block ['Rising edge',13,'detector'].
set_param([sys,'/',['Rising edge',13,'detector']],...
'position',[175,268,255,312])
% Subsystem ['Error',13,'counter'].
new_system([sys,'/',['Error',13,'counter']])
set_param([sys,'/',['Error',13,'counter']],'Location',[85,438,594,606])
add_block('built-in/Inport',[sys,'/',['Error',13,'counter/in_1']])
set_param([sys,'/',['Error',13,'counter/in_1']],...
'position',[40,15,60,35])
% Subsystem ['Error',13,'counter/Counter'].
new_system([sys,'/',['Error',13,'counter/Counter']])
set_param([sys,'/',['Error',13,'counter/Counter']],'Location',[378,106,972,431])
add_block('built-in/Constant',[sys,'/',['Error',13,'counter/Counter/Constant']])
set_param([sys,'/',['Error',13,'counter/Counter/Constant']],...
'ForeGround',3,...
'Value','thld',...
'position',[105,100,135,120])
add_block('built-in/Relational Operator',[sys,'/',['Error',13,'counter/Counter/Relational',13,'Operator1']])
set_param([sys,'/',['Error',13,'counter/Counter/Relational',13,'Operator1']],...
'ForeGround',2,...
'Operator','>',...
'position',[225,53,255,77])
add_block('built-in/Sum',[sys,'/',['Error',13,'counter/Counter/Sum']])
set_param([sys,'/',['Error',13,'counter/Counter/Sum']],...
'ForeGround',3,...
'position',[295,100,315,120])
add_block('built-in/Switch',[sys,'/',['Error',13,'counter/Counter/Switch2']])
set_param([sys,'/',['Error',13,'counter/Counter/Switch2']],...
'ForeGround',3,...
'Threshold','eps',...
'position',[345,149,370,181])
add_block('built-in/Inport',[sys,'/',['Error',13,'counter/Counter/in_1']])
set_param([sys,'/',['Error',13,'counter/Counter/in_1']],...
'position',[15,50,35,70])
add_block('built-in/Inport',[sys,'/',['Error',13,'counter/Counter/in_2']])
set_param([sys,'/',['Error',13,'counter/Counter/in_2']],...
'Port','2',...
'position',[15,155,35,175])
% Subsystem ['Error',13,'counter/Counter/Rising edge',13,'detector'].
new_system([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector']])
set_param([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector']],'Location',[303,485,692,659])
add_block('built-in/Outport',[sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/out_1']])
set_param([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/out_1']],...
'position',[340,25,360,45])
add_block('built-in/Relational Operator',[sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/Relational',13,'Operator1']])
set_param([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/Relational',13,'Operator1']],...
'position',[200,88,230,112])
add_block('built-in/Relational Operator',[sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/Relational',13,'Operator2']])
set_param([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/Relational',13,'Operator2']],...
'Operator','>',...
'position',[265,23,295,47])
add_block('built-in/Constant',[sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/one1']])
set_param([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/one1']],...
'Value','thld',...
'position',[30,135,60,155])
add_block('built-in/Memory',[sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/Memory1']])
set_param([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/Memory1']],...
'position',[125,80,165,110])
add_block('built-in/Inport',[sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/in_1']])
set_param([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/in_1']],...
'position',[10,15,30,35])
add_block('built-in/Relational Operator',[sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/Relational',13,'Operator']])
set_param([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector/Relational',13,'Operator']],...
'position',[135,18,165,42])
add_line([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector']],[35,25;130,25])
add_line([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector']],[45,25;45,95;120,95])
add_line([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector']],[170,95;195,95])
add_line([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector']],[65,145;100,145;100,35;130,35])
add_line([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector']],[100,145;180,145;180,105;195,105])
add_line([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector']],[170,30;260,30])
add_line([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector']],[235,100;240,100;240,40;260,40])
add_line([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector']],[300,35;335,35])
set_param([sys,'/',['Error',13,'counter/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,'/',['Error',13,'counter/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 ['Error',13,'counter/Counter/Rising edge',13,'detector'].
set_param([sys,'/',['Error',13,'counter/Counter/Rising edge',13,'detector']],...
'ForeGround',4,...
'position',[80,148,140,182])
add_block('built-in/Outport',[sys,'/',['Error',13,'counter/Counter/out_1']])
set_param([sys,'/',['Error',13,'counter/Counter/out_1']],...
'position',[550,145,570,165])
add_block('built-in/Switch',[sys,'/',['Error',13,'counter/Counter/Switch3']])
set_param([sys,'/',['Error',13,'counter/Counter/Switch3']],...
'ForeGround',3,...
'Threshold','eps',...
'position',[470,139,495,171])
add_block('built-in/Memory',[sys,'/',['Error',13,'counter/Counter/Memory3']])
set_param([sys,'/',['Error',13,'counter/Counter/Memory3']],...
'orientation',2,...
'ForeGround',3,...
'position',[400,205,440,235])
add_block('built-in/Inport',[sys,'/',['Error',13,'counter/Counter/in_3']])
set_param([sys,'/',['Error',13,'counter/Counter/in_3']],...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -