# Output of differentiator op-am

I have struggled with differentiator opam operation From the formula: Vout = -RC.dVin/dt For the input signal is square wave(or triangle wave), when Vin increases, the dVin/dt should be positive, therefore Vout should be negative, but when i simulated the differentiator on Circuit Maker, it show the plot as in the picture (when Vin increases, Vout is positive). Anyone explain this to me ?

• i mean, the formula shows that the output signal should be out of phase with the input, for triangle wave, when Vin increases, dVin/dt be a constant and it's greater then 0, then Vout < 0, but when I use circuit maker, when Vin increases, Vout > 0 , that's what I dont clearly understand about – Nguyên Chương May 14 '18 at 12:13
• @NguyênChương The waveforms you have are just for a simple RC high pass filter (differentiator). The equation you have is for a high pass filter with an inverting opamp. See: electronics.stackexchange.com/questions/82314/… – awjlogan May 14 '18 at 16:24
• @NguyênChương Your question seems completely clear to me. You expect to see Vout = -RCdVin/dt. Instead, simulation shows Vout = +RCdVin/dt. You want to know why. Please post a picture of what you're simulating here, if possible. – Annie May 14 '18 at 20:03
• @Annie, i added my simulated circuit and, the first plot shows the input voltage signal, and the 2nd one is shows the output voltage signal – Nguyên Chương May 15 '18 at 2:38
• Oh I know why, it's because I use an ideal opam there ~~ thank you all – Nguyên Chương May 15 '18 at 3:01

The "in phase" relates only to sinusoidal quantities (e.g. your last row of pictures). For anything else, it's just that, a derivative, plus an RC time constant, where the case need be.

For your 1st example, the derivative of a square wave (the first half, for now) is a pulse with the value and with the duration of the slope. If the square wave is ideal, the slope is infinite, therefore the pulse is infinite -- no such thing in nature. So, the response for an actual RC differentiator to a finite slope square wave will be the voltage at the input, and then, since the square wave has reached the amplitude and it stays flat, and the derivative of a constant is zero, the output tends to go to zero, but the capacitor is still charged, so it will discharge, creating the pulse you see. If the differentiator would have been an active one (opamp), the derivative would have been a pulse with the width of the slope, and its amplitude formed by the time constant multiplied by the dV/dt.

Since the picture you show is a bit oversimplified, here are two examples of a passive and an ideal, active RC differentiator, with a $\tau$=0.1ms, in response to a step input with a finite slope of 1V/$\mu$s. The passive one:

and the active one (note the amplitude and the duration):

For the second case, you have a signal that is formed by two ramps, a positive and a negative one. The derivative of a ramp is a constant, so you get alternating positive and negative constants, or a square wave.

For none of the cases above you can talk about a phase, since the waveforms are a sum of sine and cosine waves (see this). But in the third case, it's simply the derivative of sin(x), or cos(x). Here you are dealing with harmonic waveforms, so it's safe to talk about the phase. As it happens, for the differentiator, the phase is 90o.

Also, the output is only negative, -RC*dV/dt, if you're inverting it, as in the case of an opamp.

• for the second case, the derivative of a ramp is a constant, as in the picture, Vin is increasing, dVin/dt should be positive, the -RCdVin/dt should be negative constant, but it's positive in the picture, that's what i dont understand, sorry for the unclear question – Nguyên Chương May 14 '18 at 12:21