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

📄 trigicon.m

📁 数字通信第四版原书的例程
💻 M
字号:
function [x,y] = trigicon(side,v,o, met)
% TRIGICON  Trigger Icon function for SIMULINK Triggered blocks.
%	[X,Y] = TRIGICON(SIDE,V,ORIENTATION) returns vectors which can be
%	used in a plot command inside a block mask to indicate
%	a triggered input or output.  SIDE == 0 indicates an
%	input, and SIDE == 1 indicates an output.  V is a position
%	from 0 (bottom) to 100 (top) specifying the vertical
%	spacing of the indicator.  V defaults to 50.
%	OREINTATION is the orientation of the block: 0 ==> left-to-right,
%	1 ==> top-to-bottom, 2 ==> right-to-left, 3 ==> bottom-to-top
%   met == 1, enable/diable
%   met == 2, raising edge trigger.

%       Copyright (c) 1996 by The MathWorks, Inc.
%       $Revision: 1.1 $  $Date: 1996/04/01 19:45:03 $

if nargin < 4
    met = 1;
end;
if nargin < 3
	o = 0;
end
if nargin < 2
	v = 50;
end
if isempty(v)
	v = 50;
end
if nargin < 1
    side == 0;
end;
if side == 1;
    o = rem(o+2, 4);
    v = 100-v;
end;

if met == 1
    x = [5 10 10 15 15 20];
    y = [5 5  10 10  5  5];
    y_d = -7.5;
    x_d = -10;
elseif met == 2
    x = [5 10 10 8 10 12 10 10 15];
    y = [5 5  12 8 12 8  12 15 15];
    y_d = -10;
    x_d = -5;
end;

if o == 0
    y = y + v + y_d;
elseif o == 1        % top-to-bottom
    v = 100-v;
    x = x + v + x_d;
    y = y + (100 + 2*y_d);
elseif o == 2    % right-to-left
    if met == 1
        x = 100 - x;
    elseif met == 2
        x = x + 80;
    end;
    y = y + v + y_d;
elseif o == 3    % bottom-to-top
    v = 100 -v;
    x = x + v + x_d;
end
%plot(0,0,100,100,x,y);

⌨️ 快捷键说明

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