# DC bias difference between square and sine wave?

I have a 90V DC voltage, VPP.

I have a 10Vpp (-5V to 5V), 100 kHz square wave that I'd like to re-bias at VPP/2.

Here is the output from LTSpice: Biased output starts at 45V and then 10V is added, or it seems like it is biased around 50V and swings 45V to 55V.

I expected it to be biased at 45V and swing from 40V to 50V.

When doing a 10Vpp, 100 kHz sine wave: Output is centered around 45V as expected, swinging from 40V to 50V.

This is probably a really silly question. Maybe I should re-evaluate my life.

What am I misunderstanding about the square wave here?

The simulator first finds the DC solution and uses the results as the initial conditions for the transient simulation.

Zeroing the signal source and assuming the signal source has no DC offset voltage, the voltage across the capacitor in DC steady state is 45V with the right-most terminal the more positive.

Looking closer at your pulse generator statement, I see that the initial transient solution will give 50V across the capacitor since, at time zero, the pulse source has -5V across.

Thus, 50V is initially added to the square wave; the source swings from -5V to +5V and the output swings from 45V to 55V.

After several time constants, you should find the simulation gives the results you expect.

The time constant for your circuit is

$$\tau = 5k\Omega \cdot 100 nF = 500 \mu s$$

so I would expect that if you run your simulation for, say, $5ms$, you would find that after about $2.5ms$, the simulation should be approximately what you expect.

UPDATE:

Here's a screen shot of a simulation I ran: As predicted, after about $2.5ms$, the DC voltage component across the capacitor decays from 50V to 45V and the output swings from 40V to 50V as desired.

• Dang it, it's discouraging to write an answer and post it only to find another has been accepted so soon. Oh well, back to more productive activities... Apr 15, 2014 at 18:39
• You're right, this one is better. Sorry about that. Apr 15, 2014 at 18:40
• You're in luck, I edited mine to "improve" it. Enjoy! Apr 15, 2014 at 18:50
• its a bugger when that happens LOL. Apr 15, 2014 at 22:47

The square wave starts out at a non-zero value. The sine wave starts out at zero.

The time constant of 0.1uF and 5K is 500usec. If you look carefully at the blue line in your simulation you can see it trending downward.

You need to either run the simulation for several milliseconds or figure out how to set the initial conditions so that the capacitor starts out charged to Vpp/2, not Vpp/2 -5V. I think there are a couple of ways of doing that in LTSpice.

• Thank you for your answer. Alfred's explains whats going on behind the scenes with the simulation a little better though. Apr 15, 2014 at 18:41
• +1 for suggesting to fix the initial conditions so that the voltage starts at its mean value. Of course, it would be even better if you could briefly describe how to do that in LTSpice. Apr 15, 2014 at 19:48
• You can set the initial condition of a node by using the directive ".ic". In this case I could put .ic V(biased) = 40 to get the expected result. Apr 15, 2014 at 20:01
• The .IC (eg. C=100nF IC=45) should work, but I don't use LTSpice much, and when I tried it it gave the expected initial result but was low by 0.5V after 5msec. My usual simulator (PSpice) works as expected, and as Alpha's Multisim. Apr 15, 2014 at 21:36