How to find peaks in timeseries data?
6 次查看(过去 30 天)
显示 更早的评论
I am using following matlab lines to find number of peaks in NDVI time series. However, it is not giving any peak value in timeseries data.
for i = 1:size(ndvi_data, 1)
location_data = ndvi_data(i, :);
pks, locs, ~, prominences] = findpeaks(location_data, 'MinPeakProminence', 0.1, 'MinPeakHeight',0.35, 'MinPeakDistance', 5);
num_peaks = numel(pks);
disp(num_peaks);
I am attaching input data file and request you to please suggest me how to find the peaks in ndvi time series data.
回答(1 个)
Star Strider
2024-6-21
Your code works when I run it, alhough not all ‘location_data’ vectors have identifiable peaks (all below the 'MinPeakHeight' value). .
Try this —
ndvi_data = readmatrix('ndvi.csv')
for i = 1:size(ndvi_data, 1)
location_data = ndvi_data(i, :);
[pks{i}, locs{i}, ~, prominences{i}] = findpeaks(location_data, 'MinPeakProminence', 0.1, 'MinPeakHeight',0.35, 'MinPeakDistance', 5);
num_peaks = numel(pks{i});
disp("Row "+i+" Nr Peaks = "+num_peaks);
end
figure
waterfall(ndvi_data)
hold on
for k = 1:size(ndvi_data, 1)
scatter3(locs{k}, k, pks{k}, 'r^', 'filled')
end
hold off
xlabel('Columns')
ylabel('Rows')
title('‘waterfall’ Plot Showing Identified Peaks')
Make appropriate changes to get the result you want.
.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series Events 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!