How to find the maximal and minimal derivatives of noisy signals?

조회 수: 8 (최근 30일)
heikkus
heikkus 2011년 2월 23일

Hello!

I'm currently using MATLAB for simple signal processing. I need to find the maximal and minimal derivatives (or slopes) of noisy signals. Actually I need the value of the derivative and the index at where it occurs so that I can draw a line representing the slope at that index. The picture below illustrates what I'm trying to do. The problem is that the signals are pretty noisy which will result in a very large derivative that doesn't represent the actual behavior of the signal. With some luck I managed to find the correct derivatives by constructing an averaged version of the original signal and calculating the average derivative over 10 samples at every index of the averaged signal. I'm sure there is a better way to accomplish this. Any help would be greatly appreciated.

채택된 답변

Jan
Jan 2011년 2월 23일
At first you have to decide which parts of the signal are noise. A physically motivated choice should be preferred. With this information you can create a low-pass filter such that the high-frequency signal is smoothed. With FILTFILT this filter can be applied without phaseshifting. Finnaly GRADIENT creates the derivative and MIN and MAX finds the extrema and the corresponding index.
x = rand(10000, 1);
[B, A] = butter(3, 0.2, 'low')
xFiltered = filtfilt(B, A, x);
xGradient = gradient(xFiltered);
[maxValue, maxIndex] = max(xGradient);
[minValue, minIndex] = min(xGradient);
  댓글 수: 1
heikkus
heikkus 2011년 3월 1일
Thank you for a quick reply! I'm now using butter() for creating and filtfilt() for applying the filter. The only fallback is that I have to create a different filter for every signal as the spectrum varies among these signals, but I guess this is as good as it gets.

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

추가 답변 (2개)

Vieniava
Vieniava 2011년 2월 23일

Differentiator filter should satisfy your needs.

You can use it in your mfile - Differentiator filter specification object .

You could also interactively design a filter using fdatool ( doc here) - response type should be choosed as Differentiator .


heikkus
heikkus 2011년 2월 23일
Thank you for a quick reply!
There seems to be a phase shift when using filters. I designed a differentiator filter and applied it to the original signal. I can now find the maximal derivative and index by using max() on the filtered signal but how would I find the corresponding actual derivative value and index of the original signal?
  댓글 수: 2
Jan
Jan 2011년 2월 23일
Simply use the 2nd output of MAX, which is the wanted index.
Vieniava
Vieniava 2011년 2월 23일
corresponding values could be found using order of a filter. Use odd order filter - r. Than the "response delay" could be expressed as (r+1)/2 samples (see step response of designed filter on fdatool - this clarifies a lot )

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

카테고리

Help CenterFile Exchange에서 Single-Rate Filters에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by