# Unable to low pass filter the signal

I am trying to use a basic example of a low pass filter as shown in the example: https://de.mathworks.com/help/signal/ref/lowpass.html

However, I change the frequency:

fs = 20e6;
t = 0:1/fs:1;
x = [1 2]*sin(2*pi*[70e3 300e3]'.*t) + randn(size(t))/10;
lowpass(x,100e3,fs)


The following is the response that I get: The location of the peaks are at 68 kHz and 300 kHz. I am not sure why 300 kHz is not filtered. Any guidance will be helpful.

## 1 Answer

See the documentation at https://www.mathworks.com/help/signal/ref/lowpass.html and in particular the "Steepness" parameter: You didn't specify a steepness, so it is just using the default value of 0.85 which is a transition width of 15% of $$(f_{nyquist}-f_{pass})$$, or 15% of (10MHz-100KHz) = 1.485 MHz. You see this directly with the shape of your post-filtered noise.

You could increase this to the minimum achievable that the lowpass function provides which is 1% (at the expense of filter complexity). This would result in a transition width of (10MHz-100KHz)/100 = 99 KHz which should result in significant attenuation of the 300 KHz signal.

Another approach would be to lower the sampling rate, which would be more efficient as long as there are not higher frequency signals present. This is often combined in a multi-rate approach where a more relaxed low pass filter is first used, then the sampling rate of the filtered signal is reduced (by simply taking every Nth sample after filtering where N depends on how much filtering is done) and then implementing the filter to your desired cut-off at the lower sampling rate.