필터 지우기
필터 지우기

Smooth the data and find major peaks

조회 수: 24 (최근 30일)
Megha
Megha 2018년 12월 19일
댓글: Luna 2018년 12월 26일
I have attached a data which shows some periodic peaks.
Upon close observation, it can be found that the data is not continously increasing
or decreasing over a period of sinusodal curve. The data breaks after every several interval.
Can anybody help me smootheing the data and find major increasing and decreasing peaks?
I used several functions like
x2 = smooth(x1);
x2 = smoothdata(x1,'gaussian',20);
x2 = smooth(x1,'loess');
There are still errors and I cannot observe peaks.
Can anyone please help.
  댓글 수: 1
Adam
Adam 2018년 12월 19일
If you have the SIgnal Processing Toolbox then
doc findpeaks
can help find the peaks.
I don't know what you mean by 'there are still errors' though. There are numerous ways to smooth data, it depends on the data and what is noise and what is true data that should be retained. I have sometimes used Savitzky–Golay filters for this, but gaussian smoothing or even mean smoothing can work depending how aggressive you need the smoothing to be.

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

채택된 답변

Luna
Luna 2018년 12월 20일
편집: Luna 2018년 12월 20일
findpeaks is built-in function of Matlab and it already works for detecting peaks and locations. Try below:
load('matlab.mat');
y1 = GGG1_qzss;
x1 = (1:numel(y1))'; % creates a time series for 1 seconds each you can use different time samples also
figure;
plot(x1,y1,'r');
hold on;
MPH = 8; % minimum peak height you can change it if you want
MINW = 100; % minimum peak width
[pks,locs] = findpeaks(y1,x1,'MinPeakHeight',MPH,'MinPeakWidth',MINW);
% pks: peak values
% locs: location of peaks in array
plot(x1(locs),pks,'bo');
  댓글 수: 3
Megha
Megha 2018년 12월 26일
@ Luna,
Thank you it worked for me.
Luna
Luna 2018년 12월 26일
Your welcome :)

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

추가 답변 (1개)

Sarah Crimi
Sarah Crimi 2018년 12월 19일
편집: madhan ravi 2018년 12월 19일
There is an open source function called peakdet.m. Using this function, you have to set the delta which determines what is a peak. For instance when I used this,
delta1=0.000005;
[max_m, min_m]=peakdet(m, delta1);
The link the open source file is below:

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by