# Filter output of a bandpass filter

The following question was asked in GATE 2014 S-1:

A 10 KHz even symmetric square wave passed through bandpass filter with centre frequency at 30 KHz and 3 dB passband of 6 kHz. The filter output is:

1. a highly attenuated square wave at 30 KHz
2. nearly zero
3. a nearly perfect cosine wave at 30 KHz
4. a nearly perfect sine wave at 30 KHz

As suggested by Neil_UK in his answer I remade my RC bandpass filter with lower cutoff frequency 27 KHz and higher cutoff frequency 33 KHz, according to the above circuit. I took C1 = C2 = 1 μF so that R1 = 6 Ω and R2 = 4.8 Ω approximately. With these parameter values my transfer function for output voltage across C2 came to be: $$\frac{s}{1.08\times 10^{-5}s^2 +2.8s+166667}$$

The output with this TF is plotted below:

Yet it is nowhere near a cosine wave! Does the accepted answer has to do something with the harmonic components in the Fourier expansion of the output?

Update

As suggested in the answer by Neil_UK, using a resonant filter with R1 = 100K and sampling time 1 μs, the result is purely cisoidal output at 30 KHz:

The transfer fcn is $$\frac{10^{-6}s}{28\times 10^{-10}s^2 + 10^{-6}s +100}$$

• Could you please show how your signals are being generated in Simulink? The red plot doesn't look exactly like a regular square wave to me. Commented May 26, 2023 at 8:44
• Neil_UK suggested that your raise the sampling/plotting frequency in Simulink. I did not suggest remaking any filter, and especially not with the 2 R, 2 C circuit you have. The question is assuming a good bandpass filter, certainly not the poor one you have shown the component values for. You at least need a resonant LC filter centred at 30 kHz. As you have the circuit captured, plot the frequency response of what you have built. Your new sampling frequency is barely high enough, notice how your square wave appears to have unequal periods. Commented May 26, 2023 at 11:06
• I've just quickly simulated your filter, and it's not yet -3dB down even by 10 kHz, so it's nowhere near good enough to demonstrate the question, which requires 3dB down by 27 kHz. Commented May 26, 2023 at 11:19
• @Neil_UK, ok. Let me retry with a better filter and higher sampling frequency. Commented May 26, 2023 at 11:26
• I've updated my answer with a suggested filter topology with several sets of values. Try it and see what you get. Commented May 26, 2023 at 13:29

The red lines do not look like a square wave input! You should be able to get that right before you try to do anything else with it.

That gives a clue to your first problem, aliasing.

You have set up Simulink to produce far too few data points per second to show the correct waveforms.

Increase the points per second, to a minimum of 300 kHz. We want to be able to see the shape of the 30 kHz harmonic, so we need many samples per period for plotting.

Remember that Nyquist is an absolute lower limit, and must employ a proper band-limited reconstruction filter to see what you've sampled. If you want to see what you've got by simply plotting the samples, then the sample frequency needs to be far higher.

The accepted answer assumes that you have a good enough bandpass filter to pass the 30 kHz third harmonic of the square wave, and suppress the 10 kHz fundamental. You may still have a problem with implementing a filter that meets the requirements of the question.

Try with a filter like this

simulate this circuit – Schematic created using CircuitLab

This single resonator filter gives 3dB down at roughly 27k and 33k, and over 20 dB down at 10 kHz, so will give some suppression of the fundamental. Enough of the 10 kHz will come through so that it doesn't look like a 'nice' cosine wave. Increasing R1 to 10k or 100k gives a narrower bandwidth, and so greater suppression at 10 kHz, and the waveform becomes more and more like a pure 30 kHz. With a very narrow bandwidth, the output takes a long time to start up, as the LC has to 'ring up' to its final value.

To get a fast responding filter (so keeping the bandwidth at the question's 6 kHz) with sufficient suppression of the 10 kHz to make a nice cosine output, we need a higher order filter. There are design resources online for multi-resonator bandpass filters.