9
\$\begingroup\$

enter image description here

In above picture, red square wave is the input and blue wave is the output of an RC circuit. I'm not able to understand why I get a perfect sine wave when I feed a sine wave as input. The capacitor has to take some time to charge and discharge. So my intuition cries the output to be some periodic wave whose period is half the input. Could somebody clear this up for me ? Thanks!


In time domain shouldn't it do something like this ?
At t=0, the capacitor has 0 voltage. Since the input voltage is large, the capacitor keeps charging and meets the input sine wave when its falling.

Then the input voltage goes lower than the capacitor voltage, so the capacitor starts discharging and again meets the input sine wave when it is rising.

enter image description here

\$\endgroup\$
  • 8
    \$\begingroup\$ Sin wave is a very special waveform. The capacitor current is proportional to the rate of change of the input voltage. In the mathematical league, we can say that the capacitor current is the derivative of the voltage across the capacitor with respect to time \$I = C*\frac{dV}{dt}\$. And by "accident" the derivative of the sine function is the cosine function (a phase shift sine wave). \$\endgroup\$ – G36 Jun 4 '17 at 13:19
  • 1
    \$\begingroup\$ I'd say @G36 nailed it. The output is distorted. But the distorted waveform happens to have the same shape of the input, only smaller and with a phase shift. Moreover, you can see how the "distortion" builds up if you feed a "sine" starting from t=0 (as a matter of fact, a sine is a sine only if it started being a sine an infinite time ago). You will see that the output is heavily distorted (has a different shape) until, when steady state is reached, it turns into a shifted sine. \$\endgroup\$ – Sredni Vashtar Jun 4 '17 at 14:54
  • 1
    \$\begingroup\$ ...and, by the way, all this 'looking alike' boils down to the fact that the exponential function is self-similar (it looks like itself no matter how you traslate in time). It also has a derivative that looks exactly like itself, so when you add Euler's identity you see why sines and cosines are so special. \$\endgroup\$ – Sredni Vashtar Jun 4 '17 at 15:03
  • 1
    \$\begingroup\$ The circuit is a linear system, and the steady state response to an input sinusoid will be another sinusoid at the same frequency as the input. Note, steady state means the region of the time axis where the real exponential part of the complete response has decayed to zero. \$\endgroup\$ – Chu Jun 4 '17 at 15:09
  • 1
    \$\begingroup\$ If you have the right tools in time domain it's even simpler. Sine, or more generally any cisoidal function (i.e. \$ y=\text{e}^{(\sigma+\text{j}\omega)t}\$) are eigen vectors of any LTI system. That's all. \$\endgroup\$ – carloc Jun 4 '17 at 15:41
13
\$\begingroup\$

Learn to think in frequency space. This is one of those things that is difficult to see in the time domain, but falls out nicely in the frequency domain.

A sine wave is a single "pure" frequency. A RC filter is a linear system that can't distort, meaning it can't create frequencies in the output that aren't in the input. When you only put in one frequency, the output can only contain that one frequency. The only questions are what the relative amplitude and phase shift will be from input to output.

The reason that a square wave in does not result in a square wave out is because a square wave contains lots of frequencies. Each of those can be attenuated and phase shifted independently. When you change the relative strength and phases of harmonics, you get a different looking signal in the time domain.

A square wave can be thought of as the superposition of a infinite series of sines. These are at all the odd harmonics (odd integer multiples of the fundamental frequency). The amplitude of these harmonics falls off at higher frequencies.

You can pass a square wave thru several RC low pass filters in succession, each with a rolloff frequency well below that of the square wave frequency. After each filter, the result looks more and more like a sine. That is because such filters attenuate high frequencies more than low ones. This means the harmonics of the square wave are attenuated more than the fundamental. If you do this enough, the harmonics have so little amplitude relative to the fundamental, that all you see is the fundamental. That's a single frequency, so a sine.

Added

This is not how any RC filter would react:

For a RC low pass filter, when the input frequency is well below the rolloff, the output mostly just follows the input. At well above the rolloff frequency, the output is the integral of the input.

Either way, there won't be sudden changes in output slope as you show. There is nothing special about the input crossing above or below the output since this happens smoothly. You get a inflection point in the output, but its a smooth hump since the input approaches smoothly before and leaves smoothly after.

It might be instructive to write a loop to simulate this yourself. All you have to do each step is change the output by a small fraction of the instantaneous difference of the input minus the output. That's it. Then throw a sine wave at it and see how the output smoothly follows to make another sine, although lagging in phase and lower in amplitude.

\$\endgroup\$
  • \$\begingroup\$ Thank you for the clear explanation(: Frequency domain makes it easier to understand why sinusoids inputs produce sinusoid outputs! But still kinda magic for me how all these circuits know fourier series and respond to each of the harmonics in the input separately! \$\endgroup\$ – Hiiii Jun 4 '17 at 13:55
  • \$\begingroup\$ Hey sorry I understand in frequency domain, but I couldn't convince my reasoning in time domain yet -_- Could you please look at my updated question. I've posted a new pic. Thanks again :) \$\endgroup\$ – Hiiii Jun 4 '17 at 14:17
  • \$\begingroup\$ @Hiiii, don't see it that a waveform is 'broken down' into sinusoidal waveform. See it that all these separate sinusoidal waveforms exist and that we take a 'fake' view of them as a single complex waveform. The single complex waveform is the higher-level view, not the norm. \$\endgroup\$ – TonyM Jun 4 '17 at 14:18
  • \$\begingroup\$ @TonyM Thank you, I think I'm beginning to understand in the frequency domain. But I'm getting messed up the moment I start to think what happens in the time domain. Could you please look at the updated question. I have added some explanation to the picture... \$\endgroup\$ – Hiiii Jun 4 '17 at 14:23
  • 3
    \$\begingroup\$ @Hiii In the time domain, if the input is zero for t <= 0 and a sine wave for t >= 0, the output will not be a sine wave immediately after time t = 0. There will be a transient response, which dies away with a time constant of 1/RC, superimposed on the sine wave. In the frequency domain, you "ignore" that transient, because you are considering the situation where the input is a sine wave for all times, both in the past and the future. \$\endgroup\$ – alephzero Jun 4 '17 at 14:39
5
\$\begingroup\$

Remember that the rate of change of the capacitor voltage depends on the voltage difference between the input voltage and the capacitor voltage. Your graph doesn't represent this.

When the input and the capacitor are at 0 V and the input starts rising, the capacitor voltage should start rising slowly, since the input voltage (and hence the voltage difference) is also small.

When the input peaks, the difference in voltage is at maximum, and here the capacitor voltage rises fastest. When the input voltage starts going down, the rate of the capacitor's charging also goes down. After the two voltages have met, the difference is again small to begin with, so the discharge rate is also small. As it turns out, this happens to result in another sine wave.

The graph below was simulated (with a spreadsheet) with the rule mentioned above. The voltage difference between the input and the capacitor voltage is greatest a bit before the peak of the input voltage.

Note that the graph also shows that the capacitor voltage doesn't go back to zero at \$ 2\pi \$, but stays below it. This is consistent with the capacitor voltage being phase-shifted relative to the input, it's just that it takes some time to reach a steady state after both voltages started from zero.

enter image description here

In your graph, the capacitor discharges fastest right after the two voltages meet, but that's not where the voltage difference is at its greatest. With a square-wave input, it would be, since the input voltage wouldn't change again until another "step" in the square-wave. A sine-wave input however changes constantly.

\$\endgroup\$
  • \$\begingroup\$ There is something out of place here. I get different qualitative results with my choice of lowpass RC filter (cap in series with a resistance, vin across the series, vout across the resistance). I get quadrature between Vcap and Icap (and thus Vout), but nothing like that green line positioning between Vin and Vcap (whose delay is linked to RC). Are we using the same circuit? \$\endgroup\$ – Sredni Vashtar Jun 5 '17 at 2:42
  • \$\begingroup\$ Should where the red and blue lines cross (i.e. where the input and capacitor voltage are the same) be at the local maxima/minima of the output, or -- as appears to be the case from the plots -- fractionally ahead of the min/max points? \$\endgroup\$ – TripeHound Jun 5 '17 at 7:20
  • \$\begingroup\$ Simulation in Spice shows Vcap and Icap out of phase by a constant 90 degrees, while Vcap lags Vin for an amount of time correspondent to RC. The green lines had no particular significance on this graph (should have been on the Vcap, Icap graph, instead), so it is good that they are gone. Vin and Vout are out of phase of 90degrees plus said lag. \$\endgroup\$ – Sredni Vashtar Jun 5 '17 at 12:00
3
\$\begingroup\$

You will get a sine wave out from a sine wave in if your RC time constant allows the capacitor to charge/discharge at the same rate or faster as the input waveform changes.

Your output waveform will be delayed by the capacitor charging and discharging slightly behind the changes to the input waveform, referred to as phase lag.

You will find plenty of the theory and maths behind it on the internet, if you don't have it already.

\$\endgroup\$
  • 4
    \$\begingroup\$ Your first sentence is technically correct, but leaves the erroneous impression that you would not get a sine out in response to a sine in at certain RC time constants. A sine into a RC low pass filter always yields a sine out. The only questions is the amount of attenuation and phase shift, but the function will always be a sine. \$\endgroup\$ – Olin Lathrop Jun 4 '17 at 13:28
  • 1
    \$\begingroup\$ @OlinLathrop, I do see. I was trying to keep a 'DC view' of it, if you like, staying on the charging behaviour of an RC circuit. So a high frequency sine wave into a low-pass filter (e.g. 1 MHz into an fc=1 kHz low-pass RC) will produce nothing out. Mathematically untrue but it's what happens if you stick a scope on one. I nearly wrote 'This is a non-mathemetical view of it' in para3, to show I'm trying to get an idea across. Make more sense, good, bad or need editing? \$\endgroup\$ – TonyM Jun 4 '17 at 13:46
  • \$\begingroup\$ I think you should add in the attenuation. The filter "slows down" the sine wave more as the frequency of the input sine wave increases, which doesn't change the shape but does change the relative phase and the amplitude. The accepted answer also seems incomplete to me in this regard. \$\endgroup\$ – Todd Wilcox Jun 4 '17 at 15:24
1
\$\begingroup\$

For me, time domain here is more explanative. If you look at your first graph, you see what appears as a step function (for the first half-period). That is, you suddenly apply a voltage, then keep it constant. This means that the capacitor will try to reach the applied voltage according to its own laws, here of the form 1-exp(-x).

If, on the other hand, you apply a sine wave, for the same half-period you no longer have a steep rise in voltage, and it doesn't stay constant: it will rise slower and slower, until a peak is reached, then it will decrease faster and faster, summetrically around its peak. This means that the capacitor will first charge, slower and slower, then discharge, faster and faster. What you have drawn is the result of (at the very least) a continuous charge; the sine will also discharge.

If it helps, think of the step function as a sum of all the (odd) sines, while a sine is, well, just one sine. Since your RC is a lowpass filter, it will let pass only the low frequency sines, while rejecting the higher ones. If you also think in terms of \$\sin(x)=i\frac{exp(-ix)-exp(ix)}{2}\$, it starts to become more clear.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.