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
답변 (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!