# Can someone give a detailed explanation of what happens when a square wave passes through a high pass filter?

I got asked the question at an Analog devices intern interview " Draw the output across the capacitor if a square wave is the input to a high pass filter " . It was the only one I couldn't answer properly.

To my mind an ideal high pass filter should block any low frequencies, and as a square is composed of the odd harmonics of the fundamental , I presumed the output would just look more sinusoidal.

When I researched afterwards , none of the explainations online seemed to fully explain how positive and negative spikes on output occur ( even if input doesn't go negative ) .

Am I missing something here ? I didn't take into consideration the phase shift that occurs in non linear filters . Is this part of the reason the output presents itself as spikes at low frequencies ?

• Have you tried simulating this situation to see what happens? Jan 14, 2017 at 3:51
• That's an odd way to ask the question. The output of a simple R-C high-pass filter is across the R, not across the C. Jan 14, 2017 at 6:19
• a high pass filter doesn't have an output with a capacitor across it, that's the first problem to sort out. Draw a schematic of the filter you're considering. Jan 14, 2017 at 6:19
• Good to know that Analog Devices is hiring. I was afraid they were going to shrink after the merger.
– user76844
Jan 14, 2017 at 8:13
• Read the question - it asks for the waveform across the capacitor!
– Chu
Jan 14, 2017 at 8:17

The question as it stands has an answer that depends on the square wave parameters and the filter characteristics.

Therefore you have to know at least the frequency of the square wave and the cutoff frequency of the filter. Moreover some details may differ if the filter is a simple one-pole passive RC filter or is more complex.

The comment you make in your question about non-linear filters is unclear. The term "filter", by the usual definition, refers to a linear device (unless you are analyzing non-linear effects in active filters). If you are dealing with a more complex signal processing device you should be more precise and add information.

Anyway, I'll assume that you are talking about a simple 1-pole passive RC filter like the following:

simulate this circuit – Schematic created using CircuitLab

The first thing to notice, as @Neil_UK said in a comment to your question, is that the output is across the resistor, not across the capacitor.

If you took the output across the capacitor you would have a low-pass filter, instead! Maybe that was a trick question, otherwise you may have spelled it out in a wrong way in your post.

Assuming the output is across the resistor, you should think about the relative positions of the square wave frequency, let's call it $f_s$, and the filter cut-off frequency, let's call it $f_c$.

There are three relevant cases:

1. $f_s >> f_c$
2. $f_s << f_c$
3. $f_s \approx f_c$

The first is easy: if the square wave frequency lies well above the cut-off of the filter the harmonics of the wave will pass almost unaltered, therefore you'll have essentially the same signal at the output

The second is a little more complicated: since higher harmonics' amplitude decades with frequency (i.e. with the harmonics' order), most of the relevant harmonics of the signal fall in a frequency interval where the frequency response of the filter is growing linearly (on a Bode plot), so the filter acts as a (non-ideal) differentiator for the signal. In this case you'll get an output signal which is almost zero between signal edges, whereas you'll get spikes in correspondence to the square wave's edges.

The third case ($f_s$ near cut-off) is something in-between, especially if the fundamental component is just below cut-off. The signal will be distorted: the fast-rising edges will pass, but the flat part will be attenuated, so you'll have an exponential decay shape between edges.

You didn't state whether the square wave has a DC component (DC offset), anyway even if present that DC level will be stripped-off the output signal, which will have no DC component in any case (thanks to @Gregory Kornblum for pointing this out in a comment).

The following are the results of an LTspice simulation in the three cases:

• It would be nice to mention that in any case DC level of output is zero, even if it was something else on input.
– user76844
Jan 14, 2017 at 8:11
• @GregoryKornblum Thanks for the hint. I edited my answer accordingly. Jan 14, 2017 at 8:40

Assuming the question in inverted commas is verbatim, it asks for the output waveform 'across the capacitor'. So the correct answer is the low-pass filtered waveform.

Perhaps the interview panel was looking for an answer to the question posed, and not an incorrect interpretation of it.

• Teachers & Interviewers may seek to cull those who've memorized by posing a strange scenario. In this case, the subject must clarify, or at least recognize that the question centers on a circuit voltage that is not the output. Sweet,(devious). A deeper knowledge is required. Jan 14, 2017 at 20:23