📄 firstmax.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -