find Maximum values in intervals of time(each 2000 values)
1 次查看(过去 30 天)
显示 更早的评论
0 个评论
采纳的回答
Star Strider
2022-10-28
It would help to have the data.
Try something like this —
u = randn(1, 24001);
t = 1:numel(u);
r = 2000;
U = zeros(r,ceil(numel(u)/r));
U(1:numel(u)) = u; % 'U' Matrix
T = zeros(r,ceil(numel(t)/r));
T(1:numel(t)) = t; % 'T' Matrix
[max2000,idx] = max(U);
for k = 1:size(U,2)
t2000(k) = T(idx(k),k);
end
max2000
t2000
.
更多回答(1 个)
Florian Bidaud
2022-10-28
Hi,
I would do something like that
for i = 1:(length(u)-1)/2000
maxArray(i) = max(u((i-1)*2000+1:i*2000));
end
You'll have to adjust for the last value to include the 240001st value, your last interval would be [238001:240001] instead of [238001:240000]
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!