Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Using analog computer to solve 2nd-order diff eq

  1. Mar 15, 2015 #1
    I'm trying to build a circuit to solve the differential equation x''+2x'+x = f(t), where f(t) is a sine wave with frequency 5Hz and amplitude 0.5V. I am supposed to get a sine/cosine wave (as the diff. eq is just the same as the ove governing spring-mass forced oscillation) as solution, but instead I get a delta function every 0.1s with alternating sign. What's wrong with my circuit? How should I modify it to get the solution I want, and what else do I need to pay attention when solving any 2nd-order diff equation with constant coefficients in general?

    PS: I'm actually a 1st-year physics student with very little prior experience in circuit. Sorry if this question sounds stupid. thanks
     

    Attached Files:

  2. jcsd
  3. Mar 15, 2015 #2

    analogdesign

    User Avatar
    Science Advisor

    One issue is that the common-mode voltage of the input is wrong. You need to dc bias your input source (by putting a dc source in series) so you're in the common-mode range of your first op amp.

    The easiest way to debug this kind of circuit is to simulate each independent block separately and verify they work alone before you hook them up. Circuits the size you show almost never work the first time.

    I would suggest, especially since you're a beginner, to debug the architecture of your circuit using voltage-controllled voltage sources (VCVS in SPICE) in place of your opamps. You can find out how to model opamps this way in a million spice tutorials.

    Cool circuit, I'm sure you can make it work.
     
  4. Mar 15, 2015 #3

    jim hardy

    User Avatar
    Science Advisor
    Gold Member
    2016 Award

    My analog computing course was fifty years ago.....
    but i notice

    firstly you have all 3 inputs to U2 shorted together at left side of R2 R1 and R3

    secondly you use all inverting opamps
    so your integral and double integral terms arrive back at R1 and R3 with opposite polarity yet i didn't notice a minus sign in original equation.

    hope i'm right ( see @davenn 's signature....)

    keep us posted ?

    old jim
     
  5. Mar 15, 2015 #4


    What is common-mode voltage?




    I think the circuit is probably a bit too complicated, so I try to study a first-order diff eq first. The attached circuit is for the simulation of 'dx/dt -2*x = 0.2*sin(wt)', where w=2*pi*f and f is 5Hz (I am not sure if the circuit is indeed representing the equation, please correct me if I'm wrong, especially the sign). I've tested the integrator and the summer separately and they work fine. However, when I combine them, I get an oscillatory signal with increasing amplitude. The increase is also dependent on C1*R4 (which shouldn't be the case for ideal op-amp right?). What's wrong? Basically, I'm having trouble when I need to divert the output signal back to the input signal of an integrator.
     

    Attached Files:

  6. Mar 15, 2015 #5

    jim hardy

    User Avatar
    Science Advisor
    Gold Member
    2016 Award

    As i said it's been fifty years and i'm rusty.

    See if this paper is any help, particularly around page 14.
    https://courses.engr.illinois.edu/ece486/labs/lab1/analog_computer_manual.pdf

    Darn - you got my curiosity up... i hate not being able to do what once seemed natural

    Around page 16&17 is the key , i think

    but at my age things come back slowly.

    i'll be thinking about this for next several days i'm sure.

    At this point it looks to me like your first order circuit gives Vout = x(t)
    for
    dx/dt] = 2x + 0.2(sin*wt) [1]

    have you solved that expression for various t ?

    Looking at it as an electronic circuit not an analog computer, it seems to have positive DC feedback so should integrate exponentially to a power supply rail with time constant C1R4.

    I like math but math loves to torment me.

    How does that differential equation [1] solve out?

    old jim
     
    Last edited: Mar 15, 2015
  7. Mar 15, 2015 #6

    analogdesign

    User Avatar
    Science Advisor

    Common-mode voltage is the dc level upon which an ac signal rides. I don't know the syntax for your input voltage source. Is the ac input signal riding on a dc level that is consistent with the bias point of the rest of your circuit?

    Also, it looks like the input to your integrator is not perfectly balanced. You will need to put a large-valued resistor in parallel with the integrating capacitor to keep it from approaching the rail as it is.


    That's an awesome set of notes! True analog computers are before my time but I regularly design circuits that do simple math (additions, subtractions, integrations, etc) in the analog domain in the context of analog-to-digital converters and frequency synthesizers.

    It's funny, the author makes what he calls a "pun" when we says analog circuits solve differential circuits in an analogous way, but it's not really a pun. The is *why* analog circuits are called analog circuits, because their behavior is analogous with physical systems. This is why it is natural (although impractical these days) to use them to solve differential equations.

    I agree with Jim that it appears to have positive dc feedback as you invert the input signal twice before you return it to the input amplifier. An ideal integrator has infinite dc gain so you could have trouble. As Jim suggested, check your signs.

    In my experience, something like 90% or 95% of all functionality problems with analog circuits end up being a biasing issue. I recommend you do a dc bias point and look at the voltage of every node of the circuit. Make sure you understand why the voltage is what it is.

    This link to Wikipedia will help you understand analog integrators.

    http://en.wikipedia.org/wiki/Op_amp_integrator#Practical_circuit
     
    Last edited: Mar 15, 2015
  8. Mar 15, 2015 #7

    jim hardy

    User Avatar
    Science Advisor
    Gold Member
    2016 Award

    it's coming back slowly.
    For me the light came on(and i remember that day vividly) when i realized rightmost integrator's output is x(t)
    its input is xdot(t),
    which is output of second integrator ,, whose input is xdoubledot(t)
    and so on.

    as explained in that document.
    So the trick is in writing the equation as in eq 1.19 which transcribes easily into fig 1.21.

    old jim
     
  9. Mar 16, 2015 #8

    NascentOxygen

    User Avatar

    Staff: Mentor

    There's probably nothing wrong. That may be the solution of the D.E.

    The time constant of the integrator does influence the amplitude of the output. To set up the integrator requires both time scaling and amplitude scaling, though I forget the detail.
     
  10. Mar 16, 2015 #9

    LvW

    User Avatar

    There is a fundamental error: You have connected two inverting circuits in a closed loop. This is identical to positive feedback which always results in oscillations or amplifier saturation (at one of the supply rails). For stability, each feedback loop must NOT contain an equal number of sign inversions.
     
  11. Mar 16, 2015 #10

    jim hardy

    User Avatar
    Science Advisor
    Gold Member
    2016 Award

    i'm not convinced there's an error.
    He built a circuit to solve this equation:

    dx/dt = 2x + 0.2(sin*wt)

    and if that equation has positive feedback, well, that's that.


    We should evaluate it for first few cycles of the AC term and see where it's headed.
     
  12. Mar 16, 2015 #11

    anorlunda

    User Avatar
    Science Advisor
    Gold Member

    That's true Jim, but the time domain solution of an equation with a positive root will always go to infinity. Simulations with finite results are only useful for negative feedback systems.
     
  13. Mar 16, 2015 #12

    LvW

    User Avatar

    .... provided that the circuit really solves the equation.
    Positive feedback at dc never works! This rule applies to all control systems.
     
  14. Mar 16, 2015 #13

    LvW

    User Avatar

    Dilloncyh - I don`t understand your circuit diagram; can you post the corresponding integral equations?
    For my opinion, it is not correct to have two integrators in a feedback loop.
    The input signal f(t) must be integrated twice - but the output x(t) is to be integrated only once (hence one single feedback loop)!.
     
  15. Mar 16, 2015 #14

    jim hardy

    User Avatar
    Science Advisor
    Gold Member
    2016 Award

    Thanks ! (Sheepish grin icon - you can see how rusty i've got at DE)

    If the analog circuit does the same thing as the equation it's supposed to be solving
    then the verdict is "not guilty".
    That's what analog computers do. It's their job.

    It's the job of a control system to keep a process from going to infinity.

    I'm trying to entice OP to put some numbers to it.

    dx/dt = 2x + 0.2(sinwt)

    dx = 2xdt + 0.2(sinwt)

    ∫dx = ∫2xdt + ∫0.2(sinwt)dt

    i understand why OP gets increasing signal
    but i dont see right off why it's oscillatory, just should contain a cosine term.

    As i said i've become shamefully rusty. It is with trepidation i ventured even this far.

    Improvements welcome, after all that's why we are here to share our strengths and buttress our weaknesses, no?

    old jim
     
  16. Mar 16, 2015 #15

    LvW

    User Avatar

    Hi Jim - perhaps a misunderstanding between us? All my comments were related to the 2nd order system as given in post#1.
    Only now I have recognized that you were speaking about another (simpler) system of 1st order. Sorry.
     
  17. Mar 16, 2015 #16

    analogdesign

    User Avatar
    Science Advisor

    It can be useful if the gain around the loop at dc is less than unity. Have you ever seen the bias loop of the 741?
     
  18. Mar 17, 2015 #17

    LvW

    User Avatar

    Yes - of course, if the loop gain is below unity. But this does not apply for the Miller integrators.
     
  19. Mar 17, 2015 #18

    LvW

    User Avatar

    Dilloncyh - why not realizing the classical form
    dx/dt + 2x = 0.2*sin(wt) ?
     
  20. Mar 17, 2015 #19

    NascentOxygen

    User Avatar

    Staff: Mentor

  21. Mar 18, 2015 #20
    Basically my ultimate aim is to build a circuit similar to the last circuit in this file: http://aries.ucsd.edu/najmabadi/CLASS/MAE140/NOTES/dynamic-2.pdf, and I've built the circuit here, but it doesn't seem to produce the expected result (the amplitude of the steady-state solution is just not right when I compare it to my matlab simulation, and the transient solution is also not the same).

    1. Suppose I wanna solve the diff eq of the form x''+bx'+cx=f(t), where b and c are positive. Is the circuit on the link and my own circuit actually correct? The integrator itself inverts the sign, so we need an inverted summer, right?

    2. What frequency range should I use? I heard that since the op-amp is not ideal, there may be a small offset current, so even when the input signal is zero, the output signal is not, and so the output signal may drift to the rail of the op-amp, especially when the frequency is small. To be honest, I don't actually know what this means. The oscilloscope I use during lab seems not to be working properly for frequency of the range 1-10Hz when I am testing a single inverting op-amp circuit, but it works fine when I switch to about 1k Hz. Does 1k works for the whole analog integrator circuit?

    3. Again, what values of R and C should I use? Are there any more systematic ways to study the circuit and know this? To my understanding, the product of CR should be 1 for each integrator, is it true? And the ratios of the resistors in the summer only depends on the coefficient b and c of the differential equation, right? I've added a resistor with high resistance in parallel with the capacitor as people say that it helps, why?

    thanks for reading. I know it's a lots of questions.
     

    Attached Files:

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Using analog computer to solve 2nd-order diff eq
  1. Analog Computer (Replies: 2)

Loading...