# Designing op amp circuit that has the following signal at the output

I tried combining several inverters, one summation op amp and one op amp for integration. However, LT-spice produced rubbish at the output, and was really having a tough time doing ac analysis on this big circuit. The circuit I am talking about is this one:

Few of my colleagues briefly mentioned that this can be done using only two op-amps, but I cant't seem to find that solution. All suggestions will be appreciated. And I am sorry for posting the circuit drawn on paper, but it was easier for me that way to sketch the (presumed) output signals of each stage.

-
Is the input waveform is already being produced by something else and you just need to convert input to output? – user1582568 Jan 11 at 14:00
@user1582568 Yes, and that conversion should be done using op-amps. – Emir Šemšić Jan 11 at 14:01
How accurate a linear slope does the output need to have? If the input frequency changes should the slope change proportionally? How important is the 6V and 4V breakpoints? – Andy aka Jan 11 at 14:05
@Andyaka Since this is really just an exercise to be done on paper, I suppose it should be pretty frequency-independent, and have a slope of $$k=\pm 0.8$$ at the output. – Emir Šemšić Jan 11 at 14:08
Two things jump out. First, your integrator will drift if your op amps have any input offsets or bias currents. Second, your precision rectifier is taking its output from the wrong point. Check your sources for the correct connection. – WhatRoughBeast Jan 11 at 14:18

Probably not what your professor wants, but here is a single op-amp solution:

simulate this circuit – Schematic created using CircuitLab

It's sort of in between the two previous suggestions- in practice the integrator in Dave's answer would need to have a relatively high value resistor across the capacitor anyway, so I've show how to make the slope arbitrarily linear (in practice the circuit becomes sensitive to component matching and op-amp performance if you go too far, but the improvement looks pretty good graphically).

What I'm doing is reducing the change in capacitor voltage by giving the op-amp a gain of -10 from differentiator input and then adding 9/11 of the input back onto the inverting input where the gain is +11 * 9/11 = +9 for a net gain of -1 for instantaneous changes.

-

The general form of the answer is below. Note that the second amplifier inverts both the original input signal and the integrator output. I'll leave it to you to work out the rest of the component values.

simulate this circuit – Schematic created using CircuitLab

-
How does the integrator avoid hitting the power rails - should there be a reset circuit anywhere or an extra resistor that might de-linearize the slope a bit. Just quote you "I think that we can assume that exponential curves are not allowed" – Andy aka Jan 11 at 14:36
@Andyaka: This is an academic exercise, not an industrial design problem. But as you say, to turn this into a practical circuit, just put an arbitrarily large resistor in parallel with C1. The error produced will be much, much tinier than that produced by your totally passive circuit. – Dave Tweed Jan 11 at 14:38
What does the reset circuit actually do? I fear that might be one of the problems with the circuit simulation I performed, as I got an output nearly equal to the DC supplies of the op amps. – Emir Šemšić Jan 11 at 14:40
The supplies must exceed the expected output voltages (on both opamps) at all times. This is usually not an issue in a simulation using ideal opamps. – Dave Tweed Jan 11 at 14:43

The easiest way to make this is using a high pass filter (and no op-amps just a 600nF capacitor and a 10k resistor down to ground): -

There is a slight non-linearity in the slope due to using such a simple two-component solution.

If you were going to do it differently with a much more controlled slope I would use a small MCU and a DAC for reconstructing the signal with linear slope. Messing around with integrators with no DC point control is going to be problematic and an MCU/DAC solution seems so simple if the linearity is an issue.

-
I think that we can assume that exponential curves are not allowed. – Dave Tweed Jan 11 at 14:20
@DaveTweed I have asked the OP for the accuracy of the slope. – Andy aka Jan 11 at 14:22
All of the components are assumed to be ideal, as this isn't being used(and I say that only for myself) for any specific project. – Emir Šemšić Jan 11 at 14:29
Also, this circuit produces the incorrect output polarity. – Dave Tweed Jan 11 at 14:41
Seems like the two of you are fighting. – Emir Šemšić Jan 11 at 14:46