How to find peaks in timeseries data?
7 views (last 30 days)
Show older comments
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 Comment
Answers (1)
Star Strider
on 21 Jun 2024
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 Comments
See Also
Categories
Find more on Time Series Events in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!