# Low pass filter giving sine wave ( triangular wave as input )

so i basically have a low pass filtering that is filtering a square wave and giving me in output : As far as i know the square wave can be made with the sum of multiple sine waves So the over/undershoot i have is due to the frequencies that are not being filtered.

The triangle wave i have is this one, i want to know if the same logic can be used to understand the output of the filter • Same? No. Similar? Maybe. Note that in the square wave case each harmonic composing it has a higher frequency than the original square train, so you filter some out and get a somewhat distorted square again. In your second example you don't have a periodic triangle wave, you rather have a periodic sine wave with some triangle riding on it, with a frequency higher than the carrier. So it is being filtered out leaving the carrier only. – Eugene Sh. Nov 22 '19 at 15:16
• Thanks for the comment, is it something like modulating a signal ? i mean we don t have the same signal as a modulated one but is it something similar ? – MikeKihl Nov 22 '19 at 15:38
• x-y problem? is that a PWM output? if so look into sine filter for inverters. – JonRB Nov 22 '19 at 16:49
• Fourier told the world that ANY periodic signal (function) can be represented as a infinite sum of sinusoidal signals, with different frequency, amplitude and phase. So by passing the triangle from a LPF, you cut out frequencies higher that the cut-off frequency of the filter. Can you edit your question, so that is clear what you are asking? – thece Nov 22 '19 at 16:50
• @thece except... Gibbs Phenomenon – JonRB Nov 22 '19 at 16:53

No, you're not seeing the Gibbs phenomenon on your triangle wave (although it would happen, if it were slower and had a period that's an integer fraction of your sampling rate).

What it appears that you've done is to generate a sine wave that is quite fast with respect to your sampling rate. That is why it doesn't appear to be a perfect triangle wave. Moreover, it is not a low-order integer ratio of your sampling rate (i.e., it's not exactly 2/7, but it appears to be close). Because the ratio isn't exact, you're generating aliases of the higher-order harmonics -- this is why your "triangle" wave appears to be riding on a sine wave.

Your low-pass filter, acting in sampled-time, is filtering out the rapidly-moving "triangle" part, and passing the low-frequency sinusoidal, which is genuinely there as a consequence of the aliasing. ## Harmonic Block example only causes ringing

Since the fundamental sine wave is actually 27% higher than the square wave, it is easy to induce ringing from impedance mismatch and block filters that simply truncate harmonics.

One example is by eliminating all above 5f of a squarewave, namely only 1f, 3f and 5f, you can see that the fundamental 1f is greater than the squarewave peak by 27% and ringing appears. That would be a "brick LP filter" just above 5f with 1f = 222 Hz and LPF =1kHz. ## High Q filters can cause ringing

A low pass filter with under-damped qualities or Q> 0.707 is what you have. However it is possible to eliminate the ringing by low Q filters <0.7. It is possible to choose a Bessel or Elliptical Filter and Cauer Filters to suppress this harmonic ringing. High order maximally flat Group Delay filters or linear phase shift also have this property of reducing overshoot. These are chosen due to their flat group delay or more linear phase shift properties. ( I will avoid the details here)

Here are 2 examples of 1kHz LPF's . See that the Chebychev filter is more like a brick wall filter such as used to show a 250 Hz square wave with only 1f 3f 5f and cutoff at 1kHz will have ringing or overshoot. Any questions?

" if the same logic can be used to understand the output of the filter" same logic ?

It is a principal of harmonic attenuation or ratio in -dB per octave and also phase shift as some other measurement.

Your sine has triangles that are ~ approx 19x f of the sine wave or 2,4,8,16 approximately 4 octaves at -6dB/octave per order filter so one can expect >-24dB per order filter of suppression of the big triangles. 