pickmax.m
来自「matlab code for EMT field theory project」· M 代码 · 共 24 行
M
24 行
function [Y, I] = pickmax(y)
% pick the first 5 picks
Y = zeros(5,1);
I = zeros(5,1);
% get the difference
xd = diff(y);
index = 1;
pos = 0;
for i=1:length(xd)
if xd(i)>0
pos = 1;
else
if pos==1
pos = 0;
Y(index) = xd(i);
I(index) = i-1;
index = index + 1;
if index>5
return
end
end
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?