output leading input with simple C R filter? - Page 1
Forum section: electronics / beginners

author: dentaku
author_rank: Frequent Contributor
timestamp: June 17, 2017, 01:16:06 am
content: I'm trying to figure out why the output of a highpass filter can lead the input? I mean, the X axis is time, and a capacitor and resistor can NOT create a time machineI've searched for a simple answer why this works but so far nothing is useful. Can anyone explain this in simple terms?I first though that maybe it was causing a delay of larger than 180degrees so it made it look like the output was leading but it seems that this is not what's happening.I see this only works with sine waves because I tried it with a triangle and the peaks line up.

author: Audioguru
author_rank: Super Contributor
timestamp: June 17, 2017, 01:31:57 am
content: Phase shift from an RC causes leading or lagging.

author: Marco
author_rank: Super Contributor
timestamp: June 17, 2017, 01:41:03 am
content: It can be done for Gaussian pulses too, has been done optically for instance. Which seem a bit magical until you realize the pulse becomes detectable the moment the differential starts changing, so really it's just a highly signal specific filter which makes use of that simple fact and very low noise.

author: John B
author_rank: Frequent Contributor
timestamp: June 17, 2017, 03:45:22 am
content: Capacitive reactance.The voltage across the resistor is in phase with the current flowing through it and the capacitor (or to and from the leads to the capacitor if you like). That current is out of phase with the voltage source. The capacitor only passes current when there is a change in voltage with respect to time. In simple circuit with only a capacitor, the current would be highest when the applied voltage is at its zero crossing, where the dv/dt is greatest. This explanation applies to sine waves.In your first examples with the sine waves, if Im reading the numbers right, you have a 1.5V peak input, at 1350Hz?If so, the quick calculations give you a capacitive reactance of 1179 ohms, total impedance of 2496 ohms, a series current of 601uA and a phase angle of -28.19 degrees. This should result in a voltage of 1.322V across the resistor, which looks about right from your picture. Your green input wave is lagging the blue series voltage and current by about 28 degrees.

author: sibeen
author_rank: Frequent Contributor
timestamp: June 17, 2017, 11:45:25 am
content: dentaku, just popping in to say that I agree with John B's explanation, except I get 34 degree shift, but my question is directed at you.Did you understand his explanation and do you understand complex numbers (j or i for some)? Without some idea of complex numbers the explanation probably doesn't make much sense.

author: MrAl
author_rank: Super Contributor
timestamp: June 17, 2017, 03:09:43 pm
content: Quote from: dentaku on June 17, 2017, 01:16:06 amHello there,The response you are referring to is not the total response, it is only valid for the steady state response.The steady state response for a sine or cosine wave for a simple RC high pass filter is the response after all the exponentials that are also part of the time response have decayed to nearly zero. This shows up as a constant phase shift. Before that the phase shift is not constant, but it does still appear to lead the input.The reason we see the output appear to lead the input is because the capacitor is in series with the input and output, so any charge that is accumulated in the capacitor shows up as a voltage increase to the input, which shows up as a voltage on the output that is higher than the input voltage, and that is what looks like a leading phase shift.If you plot the capacitor voltage assuming the output side is the positive reference and the input is the negative reference, you should see the cap gaining voltage as time progresses over some part of the first half cycle. This will repeat over all time with the phase shift eventually becoming constant.

author: rstofer
author_rank: Super Contributor
timestamp: June 17, 2017, 05:01:45 pm
content: Could it be as simple as "ELI the ICE man"?In an inductive circuit (the L in ELI) the voltage leads the current -- ELI = voltage E ahead of current IIn a capacitive circuit (the C in ICE) the current leads the voltage -- ICE = current I ahead of voltage ESo, in the capacitive circuit the current will lead the voltage by some amount and the current through the resistor creates the output voltage that is shown on the trace. The resistor voltage is leading the input voltage because the resistor current is leading the input voltage.

author: coppice
author_rank: Super Contributor
timestamp: June 17, 2017, 11:56:34 pm
content: Don't confuse phase with information. Information has to be causal. Phase doesn't. Information can't travel faster than light. Phase can. Phase velocity is often several times the speed of light, but its something of a mirage. Follow the information.......

author: dentaku
author_rank: Frequent Contributor
timestamp: June 18, 2017, 01:26:03 am
content: Yeah. All of this is just weird.I watched this video last night where current was leading voltage but after reading some of the responses here I can see that the voltage of the output is going tofollow the current through the resistorand the capacitorso what I saw in this video is still relevant to my question.https://youtu.be/P9xSEhPENqMI guess I kind of understand the most important parts of this video.So... If I set R1 to a ridiculously small resistance (LTSpice won't let you choose 0R) I see that current leads the voltage by 90deg like in the video. With the resistor at a reasonable size, the red current trace starts moving to the right, making the shift even smaller than it would be with just a capacitor.I decided to add some little high frequency spikes to the input to see if they would all line up with the output and of course they did, so no magical time traveling telepathy is happening hereMost importantly I can see that thecurrent of R1and theoutput voltageare in phase with each other.

author: MrAl
author_rank: Super Contributor
timestamp: June 18, 2017, 12:24:33 pm
content: Quote from: dentaku on June 18, 2017, 01:26:03 amIf you simply plot the capacitor voltage as suggested you'll see that it adds to the input. That is because the cap voltage is in series with the input voltage. That means that if the sine input is at some voltage V, the output could be at V+Vc where Vc is the cap voltage. The fact that the output voltage is therefore higher than the input voltage makes the phase look like it is LEADING the input, which after some time we can say that it really is. Keep in mind that because the cap has voltage across it, it's like adding another battery in series with the input voltage, and so the input voltage could be -0.1v while the output is some positive value so it looks like a leading phase shift.Thus the cause is the capacitor accumulating charge, which shows up as a higher voltage on the output simply because it is in series with the input voltage.

author: sibeen
author_rank: Frequent Contributor
timestamp: June 18, 2017, 01:31:57 pm
content: Quote from: MrAl on June 18, 2017, 12:24:33 pmNo, no, no, no and no.It is a simple circuit with absolutely no magic behind it. I've actually been quite amazed at some of the answers; a matter of living in a digital world for most I can only assume. The answer is rather trivial to calculate, so lets do just that.The Frequencyf = 1350.C1 =100*10-9,R1 = 2200,V1 = 1.5(I'd generally use the RMS voltage but in this case the peak voltage makes the result easier to see with the posted waveforms),j = sqrt -1The reactance (Xc) of the capacitor is given by the equationXc = 1/(2 * pi * f * C1 * j) = -1179j (ohms).The impedance of the circuit isZ = R1 + Xc = 2200 - 1179j. The absolute value ofZ = 2496 ohm. The angle of the vector is -28.19 degrees(mea culpa John B).The current flowing in the circuit is simple ohms law, albeit that Z is a complex number.V = I*Z, thereforeI = V/Z = 529.7*10-6+ 283.9*10-6j. The absolute value of|I| = 601*10-6with an angle of 28.186 degree (mea culpa John B - buggered if I know what I did last night).The voltage across the resistor R1 is again simple ohms law,V = I*R = 529.7*10-6+ 283.9*10-6j * 2200 = 1.16+ = 0.624j. The absolute value being1.322 voltswith an angle of28.186 degrees leadingthe reference voltage V1.There is no time travel, there is no woo about phase being somehow different from information (?), it has nothing to do with anything Gaussian. It is a simple application of a simple bit of maths which just so happens to have a few complex numbers in it.

author: dentaku
author_rank: Frequent Contributor
timestamp: June 18, 2017, 02:39:15 pm
content: No, no, no, no and no.It is a simple circuit with absolutely no magic behind it. I've actually been quite amazed at some of the answers; a matter of living in a digital world for most I can only assume. The answer is rather trivial to calculate, so lets do just that.Thanks for going through it in a woo-free way.If you omit all the math and try to visualize what is happening I guess this part of the video explains the relationship of voltage and current as it applies to resistors vs. capacitors better than anything else I've found.https://youtu.be/P9xSEhPENqM?t=611I guess now I need somehow of seeing how adding the resistor to ground on the output shifts the point at which the current is at it's maximum.The smaller I make the resistor the closer the current plot gets to being at it max when the voltage is at zero and the larger I make the resistor the closer it gets to having no phase difference with the voltage.

author: Rudane
author_rank: Regular Contributor
timestamp: June 18, 2017, 05:17:02 pm
content: It's a convention. If it leads by 90 degrees, it's also lagging by 270 degrees.

author: rstofer
author_rank: Super Contributor
timestamp: June 18, 2017, 05:54:31 pm
content: Quote from: dentaku on June 18, 2017, 02:39:15 pmYou can't omit the math because.. From Calculus, we know that the slope of the sine waveform is greatest as the signal crosses zero and slope is the rate of change of voltage or dv/dt. The current through the capacitor is I=C dv/dt and dv/dt is a maximum when the waveform crosses zero. So, mathematically, the current is a maximum when the voltage passes through 0. I love math! It explains so much.Like the fact that the derivative of the sine is the cosine and when the sine is passing through 0, the cosine is a maximum. The sine represents the voltage and the cosine represents the current in a perfectly capacitive circuit. That's where the pi/2 thing came about in the video; 90 degrees.If a purely capacitive circuit could be built (and I don't think it can because everything has resistance), then the current waveform would be exactly 90 degrees ahead of the voltage waveform due to this zero-crossing phenomena. You saw that when you set the R value close to 0 in LTspice. Set R to 10-6and see what happens.

author: John B
author_rank: Frequent Contributor
timestamp: June 18, 2017, 11:05:40 pm
content: Quote from: dentaku on June 18, 2017, 02:39:15 pmI would suggest working through a textbook if you aren't already, because they generally will give you all the foundational principles in a logical order. It can be very confusing if you have many disconnected bits of information that you are trying to arrange into a coherent understanding.However to give you a quick answer to your question, at a glance you can get an idea of how far out of phase the waveforms will be given by the equation phase=arctan(-Xc/R).So as the capacitive reactance Xc dominates the ratio, the phase angle approaches -90deg.As the resistance R dominates the ratio, the phase angle approaches 0deg. (in phase)But that is just another disconnected piece of information.

author: dentaku
author_rank: Frequent Contributor
timestamp: June 18, 2017, 11:42:25 pm
content: Quote from: rstofer on June 18, 2017, 05:54:31 pmI know it's nice when all the math works out but I still prefer to have a mental image of what's happening and that doesn't work for most people when it's just plugging values into a formula.When you said..."the slope of the sine waveform is greatest as the signal crosses zero and slope is the rate of change of voltage or dv/dt. The current through the capacitor is I=C dv/dt and dv/dt is a maximum when the waveform crosses zero. So, mathematically, the current is a maximum when the voltage passes through 0."that explains a lot and helps add to my mental image of what's happening

author: MrAl
author_rank: Super Contributor
timestamp: June 19, 2017, 11:11:56 am
content: Quote from: sibeen on June 18, 2017, 01:31:57 pmHello,I dont know why you would think that saying 'no' more than once is better than saying it just once, do you think it actually is more true because you said it more times than once? Because of your ridiculous reply i bet you believe that, and you think you can convince others more effectively by saying 'no' more than once.In that case:YES YES YES YES YESOk bud?Now instead of making silly replies, simulate the circuit or maybe you dont know how to do that. Look at the capacitor voltage, then make a more intelligent reply. Then, stop trying to mislead readers here.Also, YOU are the only one who says that there is any 'magic' involved. You believe in magic, i dont.You should also take a course in circuit analysis if you are going to comment on circuits. If you dont know circuit analysis, then try doing a simulation. If you cant do a simulation then try building a circuit and testing it properly.Also, you cant fully understand this circuit in the frequency domain, you must use the time domain solution. that's because the single frequency, frequency domain solution only carries with it the steady state response, not the total response.

author: rstofer
author_rank: Super Contributor
timestamp: June 19, 2017, 02:22:03 pm
content: Quote from: dentaku on June 18, 2017, 11:42:25 pmThe other solution that I tend to like uses vectors and, of course, it will give an exact solution. I have been dancing around the numbers because it seems to me that the concepts are more important than the solution. "ELI the ICE man" just hangs around forever. Everything else is details.When you draw sine waves or watch them on a scope, you are working in the time domain and you are watching changes as a function of time. When we want to see step changes or phase shifts, we are working in the time domain. We want to know what the circuit does as a function of time.When you work with impedances, you are working in the frequency domain because, among other things, the impedance varies with frequency. When we design filters, we're working in the frequency domain. We want to know what the circuit does as a function of frequency.Other than the arithmetic which will usually involve trigonometric equations/identities along with complex numbers, the concepts are pretty straight forward. The devil is in the details of the calculations.

author: MrAl
author_rank: Super Contributor
timestamp: June 19, 2017, 08:58:44 pm
content: Quote from: rstofer on June 19, 2017, 02:22:03 pmHi there,Well, not exactly. When we work with sine waves (or cosine waves) and talk about phase we are working in the frequency domain. Simply put, the time domain knows nothing of phase because phase is a frequency domain specification. To make this more clear, when we measure something on the scope and the x axis is time, we are measuring time, not phase. We can convert the time to phase *sometimes* but not other times, but either way we are still measuring time not phase directly. Note the difference between measuring something on the scope with the x axis being time and using Lissajous patterns.Yes, sine waves have a time domain representation, but when we analyze a circuit like an RC filter there is more to it than just a sine wave, and in the frequency domain we loose part of the signal that shows us what is really happening. For example, ELI the ICE man is a good way to remember the sinusoidal phase response for some components, BUT what is not included in that explanation is the start up time response. We can see this on the scope, but we might have to look very fast or use a storage scope because we'll miss that exponential part that is not included in the frequency domain part of the response.The best explanation of this however is in the actual time domain response, which BTW can not be extracted from the frequency domain response if the frequency domain response is only represented by sine waves. The actual frequency domain response in time for R=1, C=1, w=1, would be:Vout/Vin=sin(t+pi/4)/sqrt(2)and that is a simple sine wave with a certain phase shift and amplitude, and we can see that is in the "time domain". However, the complete time domain response (same components) is:Vout/Vin=sin(t+pi/4)/sqrt(2)-e^(-t)/2and this makes it clear that we did not have access to that exponential part in the frequency domain representation even though we had shown it in the time domain.What is more important about the original question though is what the cap is doing. the cap is gaining voltage and so it shows up as an apparent phase shift on the output.ELI the ICE man is a good way to remember some things, but to clearly see why the output phase is what it is we have to look into the time response from t=0 not after a number of sine waves have already passed.

author: sibeen
author_rank: Frequent Contributor
timestamp: June 20, 2017, 02:43:57 pm
content: Quote from: MrAl on June 19, 2017, 08:58:44 pmI'm sorry if my previous response made you angry, but this is a beginners thread and I was trying to explain that some simple mathematics (albeit complex) can easily explain the waveforms the OP was seeing in their LT simulation.I'm not sure what your above quoted sentence actually means. The maths shows that we will have a displacement of approximately 28 degrees between the voltage across R1 and the voltage V1. This will be the case for the steady state condition. Yes, the initial conditions at T = T0+ are slightly different, but after a very short period the circuit will settle down to the steady state and I'm reasonably sure that is what the OP was inquiring about.

author: MrAl
author_rank: Super Contributor
timestamp: June 20, 2017, 03:02:34 pm
content: Quote from: sibeen on June 20, 2017, 02:43:57 pmHi again,Very understandable that you suggest a method such as that, and thanks for explaining your point of view.The point i was trying to get across was that we should not look at the sine wave AFTER the effect takes place, because then we just see the same thing that everyone was talking about, namely the phase shift. Once we see the phase shift it's too late to understand exactly WHY that phase shift is there in the first place.It's like seeing a car drive around the bend where we cant see the car before it goes around the bend. When we see it after it goes around the bend we dont know if it was traveling for an hour or it pulled to the side of the road for several minutes and then took off again just before it reached the bend in the road. If we could see the car before it hit the bend, we would know what it was doing before it hit the bend as well as after it hit the bend, and we could figure out why it was going at the speed it was based on the way the car accelerated for all time before it got to the bend in the road.So it's a very simple concept really, if we want to understand the reason the phase shift got there, we have to look at the time response for all time, not just for some section of time after we've lost some information.We can look at it later and see the phase shift and figure out that a certain equation calculates the phase shift at that point (in the frequency domain) but that's not going to show us how it actually came to be that way. To contrast, we could have had a different circuit produce that very same phase shift and then there could be an entirely different reason for why the phase shift is what it was.So to get to the heart of why the phase shift is what it is, we have to look at the entire time response. This gives us more detailed information that we can use to make an evaluation. In fact for this circuit if we look at the time response just before the first peak, we can see what is happening.To give a quick idea of how to calculate the phase shift, we have:Ph=atan2(imagpart,realpart)where imagpart and realpart are the imaginary and real parts of the response. This very clearly and concisely and accurately gives us the actual phase shift, but it does not tell us why it is there or how it got there.The natural world is what it is regardless how many equations we have. It is better to understand the true nature of a circuit than to just have the formulas that describe the behavior, even though those formulas may give us precise results. I provided these details because it sounded like the OP wanted to fully understand how the phase shift gets to be what it is.