# Filter type selection for signal envelope detection

Working on a signal envelope detection code in Matlab in which an RF signal envelope is to be created. The flow is such that filtering is performed according to the detected presence of a signal in a wide bandwidth channel (Filtering done to improve SNR) which is followed by hilbert transform and envelope creation.

My question here is that for envelope detection, do I really need to use a linear phase FIR filter or IIR filter will do an equally good job for envelope detection with added advantage of lower computation and latency. In other words should I care for non-linear phase distortions when I just need the envelope?

Obviously, when the envelope detection is of concern, the signal (e.g., a sound signal) must be reconstructed so that it looks like the original one as much as possible which means maximising SINAD (signal-to-noise and distortion ratio) as the waveform distortion comes into play.

Filters that are having a linear or constant phase response is favourable especially those which are utilised for filtering signals that are composed of multiple sinusoids, i.e., periodic waves.

The image below briefly shows the outputs of two types of filters: Linear and nonlinear phase filters. It is assumed that both filters are preserving the red, blue and green sinusoids.

As a result of the phase response, a delay occurs in time domain which is named as the group delay. The formula for the group delay is;

$$\tau_{g}(\omega) = -\frac{d\theta(\omega)}{d\omega} s$$

In the formula, $$\theta(\omega)$$ is the phase response of the system of interest and $$\omega$$ is the angular frequency in rad/s.

If the phase response of the system is constant, the group delay will be zero as the derivative of a constant is zero. If this is the case, none of the sinusoidal components of the input signal will face a filtering-related delay, but the propagation delay is inevitable (at least right now). On the other hand, if the response is linear, the group delay will be some constant. If this happens, all of those sinusoidal subcomponents will be delayed equally. However, nonlinear phase response results in group delays that are varying by the frequency, i.e., there may not be equal amount of time delay for each component.

The amount of group delay of a linear phase filter doesn't matter from the distortion point of view as the output signal will be the delayed version of the input signal. But, different amounts of delay results in a waveform that may cause the SINAD to be so low that the filter may produce a signal that is highly uncorrelated to the input waveform.

When the information signal is wanted to be look nearly the same after numerous processes, systems that exhibit constant or linear phase behaviour over frequency is preferred (e.g., hi-fi audio systems).

In order to prove the concept that I've talked about, I've created a test environment on Simulink. Since the RF signal of concern of yours is unclear, and for maintaining diversity, I've focused on getting the envelope of a pulsed radar signal. The test system on Simulink can be seen below.

In this system, a sine wave of 10 kHz is used. On the other hand, a pulse train of 1 kHz and 0.5 duty cycle is turning the sinusoidal waveform on and off. Although, in real life scenarios, those frequency levels are not used, I've chosen them so that the computation and observations are made relatively easy.

There are RF band-pass filters which can be thought to filter out the unwanted components that are added during the RF signal travels through the channel. I've implemented a linear and a nonlinear phase band-pass filter so that the theory and the comment can be proven. The following images show the magnitude/phase and group delay responses of the linear band-pass filter.

Next up, the regarding responses of the nonlinear phase filter is given below.

The Hilbert transformers (filters) are kept to be the same (both exhibit linear phase spectrum along the passband) so that the independent variable is just the phase linearity of the band-pass filters. The common response of the Hilbert transformers are as follows:

The expected group delay that is going to be seen at the end of the upper branch is around 520 us. The other group delay that is going to be observed on the output signal of the lower branch is approximately 300 us. The below images shows the pulsed radar waveform and the respective envelope signals.

It is apparent that the nonlinearities result in a much distorted envelope which makes it relatively hard to anticipate the pulse duration. For example, if you want to measure the PRF (pulse repetition frequency) of the radar pulse, it is obvious that the yellow envelope produces much accurate results.

I hope this edit on the answer satisfies you.

• Thanks for your detailed response. I am well aware of the group delay phenomenon. I think my question lacked some clarity, the envelope detection I am trying to do is not for amplitude demodulation or stuff like that but rather simply detecting the presence and duration of the signal at a reasonably accurate accuuracy Commented Jun 20, 2022 at 9:00
• @malik12 Okay, I understood. Linearity of the phase response may be, besides the shape of the wave, prominent in capturing the duration of the signal. The linear behaviour can be a good choice in determining the duration of the waveform as close to the original one as possible, especially if the signal duration is much less than a group delay amount. Otherwise, the signal may be distorted so that if the original duration is 2 ms, the output may be 5 ms long. However, if the duration is so long that the group delay is just a tiny fraction of it, the filter selection may not be that strict. Commented Jun 20, 2022 at 9:48
• sorry for the late response and thanks for adding the detailed explanation and simulation Commented Jun 23, 2022 at 17:41
• @malik12 No problem. Commented Jun 23, 2022 at 18:15