Investment Studio > Expressions > Functions > DSP > MAKE_NOTCH
float array[1][4] make_notch(float normalized_frequency, float radius)
Returns the parameters for a notch filter with the specified normalized_frequency (range ]0, 0.5[, where 1 is the sampling rate) and radius Î [0, 1[.
Notch filters are used to remove narrow frequency bands.
The normalized_frequency is the central frequency to be removed, expressed as a fraction of the sampling rate (hence the "normalized" in normalized_frequency). The sampling rate is the inverse of the sampling period. For a data series containing one value per day, the period is one day and the sampling rate is one per day; the upper normalized frequency limit of 0.5 then means that cycles shorter than 1 / 0.5 = 2 days can not be filtered out. This is because half the sampling rate (the Nyqvist frequency) is the highest frequency component that can be reconstructed from a sequence of evenly sampled values (Nyqvist's theorem), so normalized frequencies higher than 0.5 can not be resolved, let alone filtered out.
The radius is a measure of the filter's resolution, i.e. of the narrowness of the stopband (the frequency range to be removed). Increasing the radius increases the filter's resolution.
Examples
To explore the relation between the radius and the notch filter's behaviour, we can exploit the fact that the frequency response of any linear, time-invariant filter is just the Fourier transform of the filter's impulse response (the filter's output when the input sequence is a unit impulse, i.e. a single 1 surrounded by zeros, effectively all the way both to positive and to negative infinity).
This means that we can visualize the difference in frequency response between notch filters with different radius by passing a unit impulse through each one and computing the Fourier transforms of their output.
With the symbol definitions
_impulse = index(m1(1024), 0, 1)
_25 = fftp(notch(make_notch(0.25, 0.25), 1, array(_impulse)))
_50 = fftp(notch(make_notch(0.25, 0.50), 1, array(_impulse)))
_75 = fftp(notch(make_notch(0.25, 0.75), 1, array(_impulse)))
_99 = fftp(notch(make_notch(0.25, 0.99), 1, array(_impulse)))
the graph sources
=1024 * index(array(_25), x + 1, 1)
=1024 * index(array(_50), x + 1, 1)
=1024 * index(array(_75), x + 1, 1)
=1024 * index(array(_99), x + 1, 1)
(where the "+ 1" is to skip the zeroth, constant "harmonic") yield the following amplitude response curves (red is for radius = 0.25, green for radius = 0.50, blue for radius = 0.75, black for radius = 0.99):

As you can see from these examples, the radius is a non-linear parameter: increasing a large radius leads to a larger improvement in resolution than increasing a small radius by the same amount.
With the same symbol definitions as above, the graph sources
=index(array(_25), x + 1, 2)
=index(array(_50), x + 1, 2)
=index(array(_75), x + 1, 2)
=index(array(_99), x + 1, 2)
give us the following phase responses:

Note how phase distortion in the passbands is reduced by increasing the radius.
See also make_ema, make_hipass, make_lopass, make_resonator, notch.