arraymin.m

来自「通信系统的matlab仿真程序」· M 代码 · 共 25 行

M
25
字号
function [sys, x0, str, ts] = arraymin(t,x,u,flag)
%ARRAYMIN outputs the index of the minimum input.
%   This M-file is designed to be used in a SIMULINK S-function block.
%   This function will detecte the minimum number from the input and 
%   output the index number where the minimum number occured.

%   Wes Wang 4/13
%       Copyright (c) 1995-96 by The MathWorks, Inc.

if flag == 3
    sys = find(u==min(u));
    sys = sys(1) - 1;    
elseif flag == 0
    sys=zeros(7,1);
    %one sample rate
    sys(7) = 1;
    sys(4) = -1;
    sys(3) = 1;
    x0 = [];
    ts = [-1. 0];
else
    sys = [];
end;

⌨️ 快捷键说明

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