Non ideality in output square wave of a differentiator circuit - Page 1
Forum section: electronics / beginners

author: bonzer
author_rank: Regular Contributor
timestamp: February 13, 2019, 02:12:01 pm
content: Hello everyone! Please help me to understand why does that square wave at the output of differentiator circuit using operational amplifier have that spike at those points of rising edge? The input is a triangular wave with frequency of 30Hz.It's not a simple differentiator, it had a compensation so it derives till like 3kHz than it crosses the output open loop gain of the operational and starts to go down.My opinion is that at those points triangular waves have high frequency components that get cut by the differentiator and therefore can't complete the waveform at the output. What's your thoughts?

author: Benta
author_rank: Super Contributor
timestamp: February 13, 2019, 02:18:48 pm
content: Change your title from "derivator" to "differentiator", then probably more people will react.

author: emece67
author_rank: Frequent Contributor
timestamp: February 13, 2019, 02:46:03 pm
content: .

author: bonzer
author_rank: Regular Contributor
timestamp: February 13, 2019, 03:08:07 pm
content: Thanks a lot! I think it's exactly my case!

author: rstofer
author_rank: Super Contributor
timestamp: February 13, 2019, 04:51:41 pm
content: I'm on thin ice here...The triangle wave is continuous but its first derivative is not (square wave having a jump discontinuity). Therefore,the triangle wave is not continuously differentialable. So the derivative blows up at the peak (top and bottom) of the triangle wave.Note how the author wants to ignore the peak in this link:https://www.chegg.com/homework-help/questions-and-answers/derivative-triangle-wave-square-wave-illustration-shows-triangle-amplitude-periodt-line-se-q19516514I'm not sure I would put what your seeing down as the Gibbs Phenomenon because you only see it on one corner of the square wave. The GP affects both ends of both edges.When the square wave changes level, dv/dt approaches infinity. Given infinite harmonic content, dv/dt would approach quite closely. But even with modest harmonic content, the derivative will still be quite high.

author: rstofer
author_rank: Super Contributor
timestamp: February 13, 2019, 04:58:51 pm
content: Quote from: bonzer on February 13, 2019, 02:12:01 pmMy point (above) exactly. There is a lot of harmonic content in making that corner and the differentiator is doing its very best to produce a derivative.These issues with differentiators is the reason that in analog computing we keep integrating everything until we get rid of derivatives altogether (where such is possible).

author: IanB
author_rank: Super Contributor
timestamp: February 13, 2019, 05:07:17 pm
content: Quote from: bonzer on February 13, 2019, 02:12:01 pmSome people above have given you the mathematical explanation, but the practical explanation is that a perfect square wave is a mathematical abstraction that is not realizable in practice. It is functionally impossible to produce a perfect square wave with any circuit--you can only get a sufficiently good approximation. If you zoom in on the corners you will always see some kind of imperfection, either rounding or overshoot.

author: rstofer
author_rank: Super Contributor
timestamp: February 13, 2019, 05:14:40 pm
content: But...I have been working through Calculus with my grandson over the last couple of years and we have run into this definition on several occasions. I was so happy with the "continuously differentialable" bit that I was going to send him a link to the thread. He'll be so proud!But first I have to wait and see if I get blown out of the water. If that happens, I'll just quietly return to my corner and take a nap. Old people need naps...Yes, the corner will never be perfect but the derivative didn't go to infinity either. All this proves is that dv/dt isn't infinite in a realizable circuit.

author: IanB
author_rank: Super Contributor
timestamp: February 13, 2019, 05:26:56 pm
content: We can say that "continuously differentiable" is the same as saying "the derivative is continuous". A square wave is not a continuous function since at the steps the value of the function is undefined (there are no actual vertical lines in the mathematical plot, there are just gaps between the upper horizontals and the lower horizontals).One way to put this on a theoretical footing mathematically is to apply the epsilon-delta theorem of continuous functions to the square wave.Another way to consider this is to recognize that a true square wave has infinite frequency content. Since no real circuit can handle infinite frequencies it means no real circuit can produce a perfect square wave.

author: IanB
author_rank: Super Contributor
timestamp: February 13, 2019, 05:29:12 pm
content: With reference to post above:https://youtu.be/kfF40MiS7zA

author: rstofer
author_rank: Super Contributor
timestamp: February 13, 2019, 05:49:50 pm
content: https://www.3blue1brown.com/is one of my favorite sites. I have spent may hours hanging out around there as well as at Khan Academy and CalcWorkshop (fee).

author: emece67
author_rank: Frequent Contributor
timestamp: February 13, 2019, 06:22:51 pm
content: .

author: rstofer
author_rank: Super Contributor
timestamp: February 13, 2019, 06:24:47 pm
content: Quote from: IanB on February 13, 2019, 05:26:56 pmPractcally, I think the circuit will be limited by the slew rate of the UA741 which is about 0.5V/us. I would sure want to know more about the component values because I have problems when the simulation output is in terms of nanovolts.

author: Audioguru
author_rank: Super Contributor
timestamp: February 13, 2019, 07:11:08 pm
content: The 741 opamp is 52 years old. Bury it and let it RIP.

author: rstofer
author_rank: Super Contributor
timestamp: February 13, 2019, 07:22:46 pm
content: Quote from: Audioguru on February 13, 2019, 07:11:08 pmExcept that both of my Comdyna 6 Analog Computers are loaded with 741s and replacements are expensive. I'm somewhat reluctant to substitute but at some point that may just be the way it works out.

author: IanB
author_rank: Super Contributor
timestamp: February 13, 2019, 09:01:29 pm
content: Quote from: rstofer on February 13, 2019, 07:22:46 pmOn an analog computer we would do both amplitude and frequency scaling for any given problem. So if the desired frequencies in the system being modeled exceed the limiting slew rate of the amplifiers, one could just change the frequency scale to bring things into range.There may be other performance limits of the 741, but if the analog computer was designed around those amplifiers, then substituting them for more modern amplifiers with higher performance may just introduce new compatibility problems with the rest of the system? I would be cautious.

author: bonzer
author_rank: Regular Contributor
timestamp: February 13, 2019, 09:15:33 pm
content: Thanks a lot for you answers. I also wanted to notice that these are the results of a simulation circuit.I'm still a bit confused, I'd like to point out the problem in an accurate way because it's for an university work (but it's a brief comment so feel free to add here whatever comes to your mind).I attached differentiator's bode diagram of the gain.So what we have from what you said is that:Gibbs phenomenon is a math abstraction so is not exactly rappresented by the circuit as it is real and has attenuation therefore high frequency harmonics get attenuated and not truncated. What we see is then an approximation of the Gibbs fenomenon, not at both ends of the edges because of the real behaivor of the circuit (phase shift and so on, as said by emence67)The problem of non differentiable points of the triangular wave doesn't convince me enough, why wouldn't it just saturate at those points then? Anyway it might be, I'm not surePhase non linearity - could be the biggest contribution to those overshoots as we don't have here a linear phase systemIn confirmation to the last point, I've just found an example of a butterworth filter vs bessel filter (bessel has linear phase) having a square wave at the output on this link. The case looks similar but I don't know how much it is related.https://www.allaboutcircuits.com/technical-articles/how-to-low-pass-filter-a-square-wave/

author: rstofer
author_rank: Super Contributor
timestamp: February 13, 2019, 10:05:09 pm
content: If you stop and think about a C-R differentiator where the signal goes in the C and comes out the junction between the R and C, you will see the same spike when the triangle or square wave changes shape.https://www.electronics-tutorials.ws/rc/rc-differentiator.htmlLook at the waveforms about 1/2 way down the page. The bottom waveform is a typical differentiator used to generate a clock pulse from a square wave. It would be cleaned up with a Schmitt Trigger perhaps but the idea is to find the edges of the square wave where dv/dt heads off toward infinity and the output waveform has the characteristic differentiator spike.This is exactly what you have except your circuit is more elegant. But a differentiator is a differentiator and the derivative at the point of inflection or jump discontinuity is undefined.In my view, Gibbs Phenomenon is a completely different animal and will always affect all 4 corners whereas the differentiator only looks at the 2 edges and the direction of the pulse is in the same direction as the edge transition.Actually, GP is just a math problem. Add another harmonic and it will be reduced. Add a dozen more and it will be reduced further. Include an infinite number of terms and it will disappear. As you build up a square wave from a sine wave and its harmonics, it is the corners that are the last to fill in.http://recordingology.com/in-the-studio/distortion/square-wave-calculations/MANY years ago, logic systems weren't always synchronous and it was quite common to use the edge of some signal to create a pulse to clock some part of the circuit.