firstmax.m
来自「为了下载东西」· M 代码 · 共 37 行
M
37 行
function X = firstmax(Data,Window)
% Find first maximum in transient response
%
% function X = firstmax(Data,Window)
%
% Data Time series of process output
% Window Width of window
% X Index of first maximum in Data
%
% It scans Data from the left looking at a
% portion at a time. The current point is in
% the middle of the window. The current point
% is a maximum if it is the largest value in
% the window. If not, move window right.
% Jantzen 940410
N = length(Data) ;
W = round(Window/2) ;
Current = W + 1;
X = [] ;
while (Current < N) & isempty(X),
TestSet = Data(max((Current-W),1):min(Current+W,N)) ;
Imax = find(TestSet == max(TestSet)) ;
if any(Imax < W) | any(Imax == length(TestSet)), % max on boundary ;
DCurrent = W ;
else % max interior ;
DCurrent = max(- W - 1 + Imax, 0) ;
end ;
if DCurrent == 0,
X = Current ;
else
Current = Current + DCurrent ;
end ;
end ;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?