edge.m

来自「关于svc的matlab仿真模型」· M 代码 · 共 42 行

M
42
字号
function  edge_s=edge(u)

global edge_value;
global last_cycle;
global last_u1;
global last_u2;

if isempty(edge_value)
	edge_value=0;
end

if isempty(last_cycle)
	last_cycle=0;
end

if isempty(last_u1)
   last_u1=0; 
end

if isempty(last_u2)
   last_u2=0; 
end

if (u(1,1)==last_u1)&(u(2,1)==last_u2)
    edge_s=edge_value;
    return;
end

last_u1=u(1,1);
last_u2=u(2,1);

if u(1,1)==1
    if (u(2,1)==1) & (last_cycle==0)
        edge_value=1;
        last_cycle=1;
    elseif u(2,1)==-1
        last_cycle=0;
    end
else
    edge_value=0;
end
edge_s=edge_value;   

⌨️ 快捷键说明

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