arraymax.m
来自「Proakis《contemporarycommunication system」· M 代码 · 共 25 行
M
25 行
function [sys, x0, str, ts] = arraymax(t,x,u,flag)
%ARRAYmax outputs the index of the maximum input.
% This M-file is designed to be used in a SIMULINK S-function block.
% This function will detecte the maximum number from the input and
% output the index number where the maximum number occured.
% Wes Wang 4/13
% Copyright (c) 1995-96 by The MathWorks, Inc.
if flag == 3
sys = find(u==max(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 + -
显示快捷键?