Effacer les filtres
Effacer les filtres

find the first data points which consecutive increase in value matlab

8 vues (au cours des 30 derniers jours)
Bálint Kovács
Bálint Kovács le 8 Nov 2022
Commenté : Image Analyst le 8 Nov 2022
Hi!
I have an time series data where the values starts to increase and decrease. I would like to find the first points where it starts to decrease and where it starts to decrease. And another problem is that after the last endpoint it does not starts decline.
I attach the data and an image which points I would like to find.
I tried before local maxima and minima, but it is not working very well, since the data have some noise and I was unable to overcome the issue with that approach. So I think maybe using the data as a sequnce of a number would be better approach.

Réponses (1)

Image Analyst
Image Analyst le 8 Nov 2022
  2 commentaires
Bálint Kovács
Bálint Kovács le 8 Nov 2022
Déplacé(e) : Image Analyst le 8 Nov 2022
It is good to find the first two peaks if I set tresholds, but it does not find the 1. 2. and 3. point and the last point as well :(
Image Analyst
Image Analyst le 8 Nov 2022
Here is a start:
s = load('angle_raw.mat')
s = struct with fields:
Angle: [93480×1 double]
angles = s.Angle;
plot(angles, 'b-');
grid on;
[peakValues, indexesOfPeaks, w, p] = findpeaks(angles, 'MinPeakProminence', 5)
peakValues = 3×1
355.9077 355.7132 356.2584
indexesOfPeaks = 3×1
8126 48196 87798
w = 3×1
1.0e+04 * 1.6867 1.6883 0.4747
p = 3×1
460.2275 460.6227 365.7303
if ~isempty(peakValues)
hold on;
plot(indexesOfPeaks, peakValues, 'rv', 'LineWidth',2)
end
% Find valleys
[valleyValues, indexesOfValleys, w, p] = findpeaks(-angles, 'MinPeakProminence', 5)
valleyValues = 2×1
104.9095 105.0077
indexesOfValleys = 2×1
38387 78446
w = 2×1
1.0e+04 * 2.3173 2.2713
p = 2×1
460.6227 460.9154
valleyValues = -valleyValues;
if ~isempty(valleyValues)
hold on;
plot(indexesOfValleys, valleyValues, 'r^', 'LineWidth',2)
end

Connectez-vous pour commenter.

Produits


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by