필터 지우기
필터 지우기

find the first data points which consecutive increase in value matlab

조회 수: 8 (최근 30일)
Bálint Kovács
Bálint Kovács 2022년 11월 8일
댓글: Image Analyst 2022년 11월 8일
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.

답변 (1개)

Image Analyst
Image Analyst 2022년 11월 8일
  댓글 수: 2
Bálint Kovács
Bálint Kovács 2022년 11월 8일
이동: Image Analyst 2022년 11월 8일
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 2022년 11월 8일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by