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

8 次查看(过去 30 天)

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 个评论
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