# Selective Discrete Time Derivative Filter

I have hit a problem which could be probably solved via discrete time derivative filter able to calculate the derivative of two specific harmonics of the input signal (namely frequencies: $$f_1 = 100\,\mathrm{Hz}$$, $$f_2 = 142\,\mathrm{Hz}$$) and the rest of the input spectra let unchanged. My question is whether such a selective discrete time derivator ever exist and if so how can be designed? Thanks in advance for any suggestions.

• I think you need to define (ideally mathematical) what you mean by "selective". Discrete time derivatives are kind of tricky to start with. So the more we understand what exactly you are trying to do and what your specific requirements are, the more we can help. Nov 18, 2022 at 14:36
• @Hilmar thank you for your reaction. I know two frequencies of the input spectra at whose I would like to apply the derivative and at the same time let the rest of the input spectra unchanged. Nov 18, 2022 at 14:43
• In the time being I am not able to give more information. Nov 18, 2022 at 15:10

You may chose of the following options:

### Theoretic Approach

If you know for sure those 2 singular frequencies, you could remove them from the data using notch filters and just add their mathematical derivative (The derivative of harmonic signal).

### Practical Approach

1. Design a FIR Derivative Filter
You can use the method of Finite Differences or even follow a great answer by Olli Niemitalo (I need to find his derivation of optimal coefficients).

2. Design a Notch Filter to Remove Those Frequencies
Use any method which fits your data assumptions.
One filter per frequency.

3. Design a Band Filters to Remove All Other Frequencies
Use any method which fits your data assumptions.

4. Apply the Band Filters
Apply the filters, you should get 2 signals, each per frequency.

5. Apply the Derivative Filter on Each Signal
Use the filter from (1) and apply it on each signal from (4).

6. Apply the Notch Filters
Apply the Notch Filters from (2). One after one on the signal.

7. Combine the Signals
Add the signals from (5) to the output of (6).

This will result in an equivalent filter with selective frequencies to derive. It won't be prefect, but with good design it will be close to optimal.