Help on RC Differentiating circuit

MrChips

Joined Oct 2, 2009
34,829
@Vihaan@123:

Given a decent sketch, it takes four simple equations to relate the various transition points to each other and another four to solve for whichever one you want.

The Vpp is approx 1320 mV. That should serve as a check to see if you got the answers for Vmin and Vmax correct.

Don't make it harder than it is.
I got the same answer too. What I don't understand is that the resulting waveform should have an average voltage of zero.
This appears to be the case. I cannot see what in the math satisfies this condition.
 

WBahn

Joined Mar 31, 2012
32,887
I got the same answer too. What I don't understand is that the resulting waveform should have an average voltage of zero.
This appears to be the case. I cannot see what in the math satisfies this condition.
It's a high-pass filter, so it blocks the DC component. This causes a shift of the min/max voltages in a direction that makes this happen. This is essentially what is happening during the transient response. If the DC response isn't zero, there is residual charge on the cap that makes the next cycle move in a direction that lessens it.
 

WBahn

Joined Mar 31, 2012
32,887
I got the same answer too. What I don't understand is that the resulting waveform should have an average voltage of zero.
This appears to be the case. I cannot see what in the math satisfies this condition.
You can actually approach the problem from that standpoint and get the same answer.

Assume an arbitrary Vmin and Vmax and calculate the average voltage.

Set that to zero and solve for the ratio of Vmax/Vmin.

Then look at the time-domain waveform and find the relationship between Vmax and Vmin using one of the waveform edges or the other.

Use the Vmax/Vmin ratio to eliminate either Vmax or Vmin from this last equation and solve for the other and you get exactly the same values as doing the steady-state time-domain analysis.
 

WBahn

Joined Mar 31, 2012
32,887
Below steady state analysis
View attachment 360625
Transient analysis


I am not sure how much i am correct.
You got it, except you were a little loose with the sig figs.

Unless something dictates otherwise, the general rule in engineering is that works should be good to, and presented to, three sig figs. If you are going to not carry the full calculations through by letting the results stay in the calculator/spreadsheet/program, then intermediate results should carry at least one, preferably two, additional sig figs to minimize accumulated roundoff errors.

In this case (shown to four sig figs), Vmin = -506.5 mV and Vmax = +813.7 mV.

You also need to start properly tracking your units through your work. Most mistakes you make -- and we all make them on a routine basis -- will affect the units, but only if the units are there and only if they are properly tracked and manipulate as part of the work.
 

WBahn

Joined Mar 31, 2012
32,887
I got the same answer too. What I don't understand is that the resulting waveform should have an average voltage of zero.
This appears to be the case. I cannot see what in the math satisfies this condition.
There's actually a quite intuitive way to see how this comes out in the math.

In order to be in steady state, the voltage across the capacitor at the end a period must be the same as at the beginning.

This requires that the integral of the current through the capacitor must be zero, since this integral represents the change in voltage across the capacitor.

But since the capacitor and resistor are in series, they have the same current, so the integral of the current through the resistor over one period must be zero.

But the voltage across the resistor is proportional to the current through it, thus the integral of the voltage across it must be zero.

Since the average voltage is proportional to the integral of the voltage across it, the average voltage must therefore be zero.

Hence, the zero DC output voltage result is a direct consequence of imposing the constraints needed to be in steady-state.
 

WBahn

Joined Mar 31, 2012
32,887
Below steady state analysis
View attachment 360625
If you found yourself looking for closed-form solutions for other things, there is some simplification that can happen here that is not easy to spot immediately.

\(
\frac{1 \; - \; e^{-1}}{1 \; - \; e^{-1.5}}
\)

If we substitute
\(
x \; = \; e^{-0.5}
\)

we have
\(
\frac{1 \; - \; x^2}{1 \; - \; x^3} \; = \; \frac{\left( 1 \; - \; x \right)\left( 1 \; + \; x \right)}{\left( 1 \; - \; x \right)\left( 1 \; + \; x \; + \; x^2 \right)} \; = \; \frac{1 \; + \; x}{1 \; + \; x \; + \; x^2}
\)

Undoing the substitution yields:

\(
\frac{1 \; + \; e^{-0.5}}{1 \; + \; e^{-0.5} \; + \; e^{-1}}
\)

Multiplying top and bottom by e yields:

\(
\frac{e \; + \; e^{0.5}}{e \; + \; e^{0.5} \; + \; 1} \; = \; \frac{e \; + \; \sqrt{e}}{e \; + \; \sqrt{e} \; + \; 1}
\)

It may not look simpler, especially if you just want to evaluate it at this point, but it will likely make further algebraic work easier.
 

MrAl

Joined Jun 17, 2014
13,711
You got it, except you were a little loose with the sig figs.

Unless something dictates otherwise, the general rule in engineering is that works should be good to, and presented to, three sig figs. If you are going to not carry the full calculations through by letting the results stay in the calculator/spreadsheet/program, then intermediate results should carry at least one, preferably two, additional sig figs to minimize accumulated roundoff errors.

In this case (shown to four sig figs), Vmin = -506.5 mV and Vmax = +813.7 mV.

You also need to start properly tracking your units through your work. Most mistakes you make -- and we all make them on a routine basis -- will affect the units, but only if the units are there and only if they are properly tracked and manipulate as part of the work.
Hi,

That looks pretty good. Doing it the long way (I like to do this sometimes just to double check other results) I get:
+0.81367627677415
and
-0.50648039105565

Those are the results after around 20 cycles.

There's a trick we can use to get a reasonable approximation after just one complete cycle. The trick is, since they don't specify if the positive pulse has to come before the negative pulse at t=0 (they usually don't) we should be free to start with the negative pulse first for 0.2 seconds then the positive pulse for 0.1 seconds. The approximation after one cycle then is:
+0.81606
and
-0.50503

which are both in error by less than 0.3 percent (decimal 0.003).

This approximation makes sense when the more accurate lower result is nearly -0.5 which is the negative input excursion. We can approximate steady state right after the first cycle.

We should also be able to use the conservation of states principle as well to form an equality.

There is also a way to convert the actual time domain expressions into an infinite set which can be reduced. This ends up being a lot harder to do though, although I might have the results still in my notes somewhere for a cap charging and discharging like this circuit has.

Maybe one of the most interesting things about this circuit is that if we rely on a circuit simulator, we may miss some of the subtle values that come up, like the 6.5mv excursion above zero for the capacitor voltage, which might go unnoticed when the cap voltage is going up and down by a lot more than that.
 

MrAl

Joined Jun 17, 2014
13,711
Hello again,

I decided to try using the conservation of states principle to see how it would work out.
The results came out exactly the same as the long way using time domain expressions and cycle by cycle calculations for about 20 cycles (maybe 30).
The match surprised me as the COSP is just one calculation while the 20 cycle solution has to work with values that were calculated in the previous cycles. It looked like at least a 12 digit match using just regular 16 digit numerical values.
 

WBahn

Joined Mar 31, 2012
32,887
Hello again,

I decided to try using the conservation of states principle to see how it would work out.
The results came out exactly the same as the long way using time domain expressions and cycle by cycle calculations for about 20 cycles (maybe 30).
The match surprised me as the COSP is just one calculation while the 20 cycle solution has to work with values that were calculated in the previous cycles. It looked like at least a 12 digit match using just regular 16 digit numerical values.
Could you describe what you mean by "conservation of states" principle and the one calculation involved?

How is it different than imposing the steady-state criteria?
 

MrAl

Joined Jun 17, 2014
13,711
Could you describe what you mean by "conservation of states" principle and the one calculation involved?

How is it different than imposing the steady-state criteria?
Hi there,

Well I looked at your previous post #32 and I can't see right away where you got the expression:
(1+e^-1)/(1+e^-1.5)

or I could probably relate that to the other method. It does look like maybe you needed just one calculation too though?
By one calculation I meant just one expression that can be solved for one of the solutions. I calculated the capacitor voltage though because that was the best choice of state I thought.

The steady state idea comes from the periodic waveform which if it gets into steady state then if it starts from one level (value) it must return to that same level (value) after one period, and that time interval can be from any one point in time to any other point in time as long as the two time intervals are one period apart. Thus if t1=0 and v1=3v, then at t2=2 seconds with a period of 2 seconds v2 must also be 3v. Similarly, since at t2 we have v2=3v then 2 seconds later t3=4 we must again have 3v. But also if we had t1=1.1 seconds and t2=3.1 seconds (still a period of 2 second) then the values at t1 and t2 must still be the same. I think that conservation of states is the underlying mechanism here too though.

The conservation of states principle is a little more general, as it is about a transition from one state to the next. It just means that when we change topology the initial value of the next topology must be the same as the final value of the previous topology. This means we can have any timing and any levels, but any transition point is considered to take zero time, so the value cannot change. We might view this as being frozen in time 'while' we switch topologies the state variable must remain constant.
For example, at t=1 second if we have inductor current i=1.2 amps, then when we switch topology at t=1 second 'i' must remain at 1.2 amps for that infinitesimally short time. If at t=2 seconds if the current changes to 2.3 amps, then when we change topology again it must remain at 2.3 amps.
This does not have the constraint that the waveform must be periodic so we can have any number of transitions from one topology to another and they can all be different topologies.
When we do this with the time domain functions we end up with the periodic solution, because conserving states from one state to the other over two states leads to conserving states over one full period.

That's not to say that the net result may come out the same or similar. My result for the lower capacitor value came out to be what looks a little similar to yours:
Vc=1/(e+sqrt(e)+1)-1/2

This comes from the time domain functions that include initial values. That's the lowest capacitor voltage.
The two functions are:
V1=(-Vs-vn)*(1-e^(-tn/RC))+vn
V2=(Vs-vp)*(1-e^(-tp/RC))+vp

where
Vs is the unsigned excitation voltage 0.5 volts,
vn is the initial value just before the negative pulse,
vp is the initial value just before the positive pulse,
tn is the length of the negative pulse,
tp is the length of the positive pulse,
RC is the RC time constant.

The conservation of states would tell us that at the end of tn the value must be V1, and at the end of tp the value must be V2, and since those final values must be the initial values of the next pulse cycle, that means each one calculates each other's initial values. That allows us to form a single equation that can be solved for vp (or vn) and vp is the lowest cap voltage.
So in other words:
vn=V2 and vp=V1
because both states are 'conserved'.

This is probably only valid in classical mechanics. In QM we probably only have conservation of weirdness (haha) or maybe just probabilities.
 

WBahn

Joined Mar 31, 2012
32,887
Hi there,

Well I looked at your previous post #32 and I can't see right away where you got the expression:
(1+e^-1)/(1+e^-1.5)
Did you look at the post that was quoted? Namely Post #24. Remember, this is a discussion thread -- you need to be willing to look at the thread, and not just a single post in isolation. That expression did not just pop up out of thin air, and the quote shows where it came from.

or I could probably relate that to the other method. It does look like maybe you needed just one calculation too though?
By one calculation I meant just one expression that can be solved for one of the solutions. I calculated the capacitor voltage though because that was the best choice of state I thought.

The steady state idea comes from the periodic waveform which if it gets into steady state then if it starts from one level (value) it must return to that same level (value) after one period, and that time interval can be from any one point in time to any other point in time as long as the two time intervals are one period apart. Thus if t1=0 and v1=3v, then at t2=2 seconds with a period of 2 seconds v2 must also be 3v. Similarly, since at t2 we have v2=3v then 2 seconds later t3=4 we must again have 3v. But also if we had t1=1.1 seconds and t2=3.1 seconds (still a period of 2 second) then the values at t1 and t2 must still be the same. I think that conservation of states is the underlying mechanism here too though.

The conservation of states principle is a little more general, as it is about a transition from one state to the next. It just means that when we change topology the initial value of the next topology must be the same as the final value of the previous topology. This means we can have any timing and any levels, but any transition point is considered to take zero time, so the value cannot change. We might view this as being frozen in time 'while' we switch topologies the state variable must remain constant.
For example, at t=1 second if we have inductor current i=1.2 amps, then when we switch topology at t=1 second 'i' must remain at 1.2 amps for that infinitesimally short time. If at t=2 seconds if the current changes to 2.3 amps, then when we change topology again it must remain at 2.3 amps.
This does not have the constraint that the waveform must be periodic so we can have any number of transitions from one topology to another and they can all be different topologies.
When we do this with the time domain functions we end up with the periodic solution, because conserving states from one state to the other over two states leads to conserving states over one full period.

That's not to say that the net result may come out the same or similar. My result for the lower capacitor value came out to be what looks a little similar to yours:
Vc=1/(e+sqrt(e)+1)-1/2

This comes from the time domain functions that include initial values. That's the lowest capacitor voltage.
The two functions are:
V1=(-Vs-vn)*(1-e^(-tn/RC))+vn
V2=(Vs-vp)*(1-e^(-tp/RC))+vp

where
Vs is the unsigned excitation voltage 0.5 volts,
vn is the initial value just before the negative pulse,
vp is the initial value just before the positive pulse,
tn is the length of the negative pulse,
tp is the length of the positive pulse,
RC is the RC time constant.

The conservation of states would tell us that at the end of tn the value must be V1, and at the end of tp the value must be V2, and since those final values must be the initial values of the next pulse cycle, that means each one calculates each other's initial values. That allows us to form a single equation that can be solved for vp (or vn) and vp is the lowest cap voltage.
So in other words:
vn=V2 and vp=V1
because both states are 'conserved'.

This is probably only valid in classical mechanics. In QM we probably only have conservation of weirdness (haha) or maybe just probabilities.
The approach you describe seems exactly what I recommended all the way back in Post #7:

So, start from the assumption that the circuit is in steady state going between Vmin and Vmax each cycle. What to Vmin and Vmax have to be in order for the circuit to return to the same state at the end of each cycle that it started at? That is what steady state means.
After a few more pointed hints on what to do, I became much more explicit and step-by-step in Post #19:

It can be solved very easily with just a few simple lines of algebra. This is an extremely easy problem!

The key is to forget about the transient response and focus solely on the steady state.

Sketch the voltage as a function of time and walk it through step by step over one cycle, imposing the requirement that, in steady state, it must end up at exactly the same voltage it started with.

Just before the input voltage rises, the output voltage is at some voltage. We don't know what it is. It is unknown. We use math to solve for unknowns. So call it V0 and then solve for it.

Right after the input voltage rises, the output voltage changes from Vo to some other voltage, which is dictated by the continuity requirement of a capacitor. Call this V1. What is V1 in terms of V0?

After the rising edge, it then decays toward a final voltage, but it doesn't get all the way there before the falling edge of the input. Call the voltage it gets to V2. In terms of V1, what is V2?

Immediately after the falling edge, what is the output voltage, V3, in terms of V2?

The voltage then decays toward a final voltage, V4, but it doesn't get all the way there before the rising edge of the input. In terms of V3, what is the voltage at that point?

But this is the end of a cycle, so you know that V4 must be the same as V0. What does V0 have to be to make this happen?
The TS then took the hint and solved the problem in Post #24, which is where the expression you are puzzling about appears.

To put it all in one place:

1766075965820.png

\(
V_{max} \; = \; V_2 \; + \; 1\;V \\
V_{max} \; = \; V_{min} e^{-1} \; + \; 1\;V \\
V_{max} \; = \; \left( V_1 \; - \; 1\;V \right) e^{-1} \; + \; 1\;V \\
V_{max} \; = \; \left( V_{max} e^{-0.5} \; - \; 1\;V \right) e^{-1} \; + \; 1\;V \\
\)

Now just solve for Vmax:

\(
V_{max} \; = \; V_{max} e^{-1.5} \; - \; \left( 1 V \right) e^{-1} \; + \; 1 V \\
V_{max} \left( 1 \; - \; e^{-1.5} \right) \; = \left( 1\;V \right) \left( 1 \; - e^{-1} \right) \\
V_{max} \; = \; \left( \frac{1 \; - e^{-1}}{1 \; - \; e^{-1.5}} \right) \; V
\)

Once you have Vmax, finding Vmin is trivial.
 

MrAl

Joined Jun 17, 2014
13,711
Did you look at the post that was quoted? Namely Post #24. Remember, this is a discussion thread -- you need to be willing to look at the thread, and not just a single post in isolation. That expression did not just pop up out of thin air, and the quote shows where it came from.



The approach you describe seems exactly what I recommended all the way back in Post #7:



After a few more pointed hints on what to do, I became much more explicit and step-by-step in Post #19:



The TS then took the hint and solved the problem in Post #24, which is where the expression you are puzzling about appears.

To put it all in one place:

View attachment 360741

\(
V_{max} \; = \; V_2 \; + \; 1\;V \\
V_{max} \; = \; V_{min} e^{-1} \; + \; 1\;V \\
V_{max} \; = \; \left( V_1 \; - \; 1\;V \right) e^{-1} \; + \; 1\;V \\
V_{max} \; = \; \left( V_{max} e^{-0.5} \; - \; 1\;V \right) e^{-1} \; + \; 1\;V \\
\)

Now just solve for Vmax:

\(
V_{max} \; = \; V_{max} e^{-1.5} \; - \; \left( 1 V \right) e^{-1} \; + \; 1 V \\
V_{max} \left( 1 \; - \; e^{-1.5} \right) \; = \left( 1\;V \right) \left( 1 \; - e^{-1} \right) \\
V_{max} \; = \; \left( \frac{1 \; - e^{-1}}{1 \; - \; e^{-1.5}} \right) \; V
\)

Once you have Vmax, finding Vmin is trivial.
Hi,

Oh ok, I'd have to review it again I guess. I checked out post #24 but it seems that was written by the thread starter?

The main thing I got from it was you mentioned the "periodic" solution, which is ideologically different than the conservation of states. The periodic ideal uses two points in time with two corresponding values, while the conservation of states involves just one single instantaneous value, perhaps plus and minus an infinitesimally small increment.
So the periodic solution talks about two values in time being the same value, while the conservation of states talks about just one value at one point in time that can't change. The other thing is that the conservation of states is not concerned with steady state, although it may lead to solutions for that.

The solutions might come out exactly the same because you can derive the periodic idea from the conservation of states, and so you may end up with the same expressions even.

If you somehow did it that way too that's great :)

What I did not expect was that one of the voltages was so close to zero yet not zero.
The 'trick' I had talked about sometimes works in regular sine AC circuits too using a cosine wave instead of a sine wave. That's because if we start with one of the final values it's not going to change no matter how many cycles we look at.

If I get a chance I'll see if I can find the series solution that simplifies to a simple solution also. It's around here somewhere :)

Thanks for the discussion.
 
Last edited:
Top