3
$\begingroup$

My input signal is phase vector. I want to differentiate it to get frequency vector. My input signal is somewhat noisy. Here is the input signal. Input signal

This is the derivative of the input signal as calculated using

diff(inputSig)

Derrivative of input signal

When i differentiate this signal, I am not getting a smooth curve. The output looks 'spikey'. I am guessing it is because of the noise in the input signal (is this 'derivative kick'?). How to avoid this and get a smooth derivative curve?

$\endgroup$
  • $\begingroup$ Can you provide the data so we can experiment ? $\endgroup$ – Sektor May 27 '14 at 10:40
  • 1
    $\begingroup$ Sorry but I cannot. Have some firewall restrictions $\endgroup$ – BaluRaman May 27 '14 at 10:44
  • $\begingroup$ Are you sure that your derivative is correct? I can't see any value change in the picture at the top of around 125, so I have doubts that the second picture is really the derivative of the one above. $\endgroup$ – bonanza May 27 '14 at 19:38
  • $\begingroup$ This answer may help: dsp.stackexchange.com/a/9512/35 $\endgroup$ – datageist May 27 '14 at 23:12
  • $\begingroup$ For accurate results, you should not consider this diff() to be your choice. Basically this function subtracts two values. Check the documentation of Matlab. I'm assuming you are using Matlab though. $\endgroup$ – CroCo Jun 2 '14 at 1:00
4
$\begingroup$

2 point discrete differentiation is bound to produce highly noisy results. try the 5-points stencil. you can also generate coefficients (i.e. more points) yourself using derivation of Lagrange polynomials.

$\endgroup$
1
$\begingroup$

Look into the "Savitsky Golay Differentiation Filter"

$\endgroup$
  • $\begingroup$ Didnt solve the problem. I am using 'sgolayfilt' in Octave to smooth the input data and taking derivative after smoothing. Still getting spikes in the derivative result. Tried increasing order of the polynomial but its not working $\endgroup$ – BaluRaman May 27 '14 at 13:21
  • $\begingroup$ I think what you want is a filter function that returns the differentiation filters, for example see mathworks.com/help/signal/ref/sgolay.html -- it looks like Octave may not have this feature. $\endgroup$ – John May 27 '14 at 15:23
1
$\begingroup$

You can find the wavelet transform and use derivatives of wavelets. In this spirit, there is a procedure to directly calculate derivatives based on them. The beauty of the wavelet transform is that you should be able to discard high-frequency components, theoretically coming from the underlying noise and sampling rate.

If you can get your hands on this and this, for example, you should be able to apply them.

$\endgroup$
0
$\begingroup$

Try boxcar line fitting with different length of times. This method filters and smooths the derivative

$\endgroup$
0
$\begingroup$

You can apply the concept of "scale" to your original data. The original data can be considered at the "finest" or "smallest" scale in the sense that all details are available to you. But you might not be interested in this level of detail since it might have noise that is affecting you.

If you convolve your original data with a Gaussian (normalized) of a given size, then you are effectively smoothing your signal and looking at a "larger scale". By choosing different "sigma" (width) of your gaussian, you can smooth your signal, hence its derivative.

You could start with a small sigma of 5-10 and see if the smoothing is sufficient for you.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.