Question about getting the transfer function with two opamps

Discussion in 'Homework Help' started by FLWrd, Jun 6, 2013.

  1. FLWrd

    Thread Starter New Member

    Jun 1, 2013
    10
    0
    Hi. This is not really a homework question, but it sure looks like it...

    I'm trying to get the transfer function of the attached circuit. It's a concatenation of two Sallen-Key low pass filters (a 3rd and a 2nd order) which follow a DA-convertor. I know how to solve them separately, and when I multiply the transfer functions, I get a result that looks exactly like the one QUCS produces. But when I try to solve the whole system at once, it produces something else.

    The problem is (I think) in the way I represent the opamps. I get the equations for each node (Va, Vb, etc.), and then I add that Vc = Vd and Vf = y (assuming a very large gain factor in both opamps). This works when analyzing each filter separately.

    So, my question actually is: is that the right way to analyze the combined circuit (and am I just making an error in solving the equations) or am I overlooking something?
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,720
    4,788
    And what, pray tell, is QUCS? A simulator? A symbolic analyzer? We are not mind readers.

    What is "it"? QUCS? Your analysis?

    These seem like reasonable things, assuming the opamp output impedance is sufficently low. Otherwise you will have a loading effect.

    If you have done the analysis separately and then multiplied them together, you should be able to craft your combined analysis into the same form fairly readily (namely the form that you started with when you multiplied the separate solutions together). Focus on that and you should see where you are treating something different or whether it is just a math blunder at some point.

    Unless you show your work, there isn't much else we can do for you.
     
    FLWrd likes this.
  3. FLWrd

    Thread Starter New Member

    Jun 1, 2013
    10
    0
    Sorry, I had assumed it was known. It's a simulator, like Spice, but I found it a bit more user friendly.
    Ok, thanks! That's good to know.
    It's partially automated, so that made it a bit difficult to work out. But will the multiplication of the separated transfer functions be exactly equal to the one of the entire circuit, or is it a decent approximation?
    Here's the starting point for the analysis:
    0. Vd - Vc = 0
    1. y - Vf = 0
    2. Va * (C2*R4+R2*R4+R2*C2) - V1 * (C2*R4) - Vb * (R2*C2) = 0
    3. Vb * (C5*R5+R4*R5+R4*C5) - Va * (C5*R5) - Vd * (R4*R5) - Vc * (R4*C5) = 0
    4. Vc * (C4+R5) - Vb * C4 = 0
    5. Vd * (R6+C5) - Vb * R6 - Ve * C5 = 0
    6. Ve * (C7*R7+R6*R7+R6*C7) - Vd * (C7*R7) - y * (R6*R7) - Vf * (R6*C7) = 0
    7. Vf * (C6+R7) - Ve * C6 = 0

    It's in particular equation 5 (in another form: Vd * (1/C5+1/R6) = Vb * 1/C5 - Ve * 1/R6, and in which I'm substituting Vc = Vd via equation 0) that I'm a bit suspicious of.
     
  4. WBahn

    Moderator

    Mar 31, 2012
    17,720
    4,788
    No point going any further. You KNOW this is wrong.

    C2*R4+R2*R4+R2*C2

    The first and third terms have units of time. The middle term has units of resistance-squared. You can't add feet and gallons.

    You have similar problems in most of the rest of your equations.

    Always, always, ALWAYS track your units!

    Most of the mistakes you make will affect your units. Isn't it a lot better to see that Eqn #2 is wrong and fix it before you go any further rather than coming up with a whole bunch of equations and doing a whole bunch of algebra that is all but guaranteed to yield an incorrect result?
     
  5. MrChips

    Moderator

    Oct 2, 2009
    12,431
    3,360
    My neighbor got two yards of top soil delivered today.
     
  6. FLWrd

    Thread Starter New Member

    Jun 1, 2013
    10
    0
    Ok, you can tell I'm not a physicist. I've assumed the common transform where a capacitor is actually a functions of s=jω: 1/(Cs). Those can be added, right?
     
  7. The Electrician

    AAC Fanatic!

    Oct 9, 2007
    2,281
    326
    What did you get for the transfer function from node V1 to node Vd?

    From node Vd to node y?

    You aren't attempting to get an overall transfer function in symbolic form, are you?
     
  8. WBahn

    Moderator

    Mar 31, 2012
    17,720
    4,788
    You don't need to be a physicist to track units -- but they often emphasize it more than most academics.

    What are the units on ω? They are radians/sec. What are the units on radians? It is length/length (length of subtended circular arc divided by length of radius) so it is dimensionless. Hence, the dimensions of ω is one over seconds, or inverse-seconds.

    What are the units on s? It is jω and j is a pure number that just happens to be purely imaginary. So it is dimensioinless. Hence, the dimensions of s is inverse-seconds.

    What are the units on 1/(Cs)? The units on C are C/V (different 'C'), or coulombs/volt, which can be seen from the defining relation of Q=CV. Hence the units on 1/(Cs) are 1/[(C/V)(1/s)] = Vs/C (volt-seconds per coulomb). But current is charge per unit time, or 1A = 1C/s, so this is also V/A, which is the unit of resistance (and reactance and impedance).

    So, yes, 1/(Cs) and R can be added together.

    And kudos for writing it as 1/(Cs) and not 1/Cs, like so many people would do, which would be (1/C)s or s/C.
     
  9. WBahn

    Moderator

    Mar 31, 2012
    17,720
    4,788
    Yeah, a lot of coloquial units are technically wrong, but I just tack on an identifier such as "two dirt-yards of top soild" where 1 dirt-yard is equal to 1 cubic yard. Sometimes I will call it an 'ignorant-ditch-digger-yard', particularly if there is a civil engineer around. That is particularly helpful to separate two units that mean to different things and just, coincidentally, happen to use the same word as a name. An example is "pounds", a "pound" can be either a unit of force or a unit of mass. So I am explicit and use lbf for the former and lbm for the latter.

    And don't start talking about how there is a difference between "weight" and "mass" and the pound is a unit of weight. Yes, there is a difference between the gravitational force on an object and the mass of an object, but "weight" does NOT mean a particular kind of force (unless context indicates that this is the intended interpretation); but that has nothing to do with what a "pound" is. Just as an "ounce" can be a measure of mass/weight or a measure of volume -- two different units that just happen to use the same word as a name -- there are two different units that are named 'pound' (and 'ounce' is either a unit of mass, a unit of force, or a unit of volume and only context can dictate which). The whole notion of "pounds is force and slugs is mass" originated in the 1930's (or thereabouts) in physics textbooks and the physics educational community has been in their own little world ever since. But whatever they have chosen to adopt and push in the classroom doesn't change the fact that NIST (the organization specifically authorized by the Constitution to define the units of weights and measures in the U.S.) specifically recognizes 'weight' to be a unit of mass and the 'pound' to be a unit of weight equal to a specified number of kilograms (about 0.454kg/lb). They also recognize the use of the terms as units of force in the common parlance and explicitly warn about the need to avoid confusion.
     
    Last edited: Jun 6, 2013
  10. MrChips

    Moderator

    Oct 2, 2009
    12,431
    3,360
    After that lesson I'll settle for 8oz of ale.
     
  11. FLWrd

    Thread Starter New Member

    Jun 1, 2013
    10
    0
    For V1-Vd I get 1 / (1+0.00003696*s+5.05296e-10*s^2+4.420251e-15*s^3), and for Vd-y I get 1 / (1+0.0000024*s+9.792e-11*s^2).
    Well, almost. I get correct results for the 2nd and 3rd order filter, but the result of the concatenation is unreadable. I think the formula was 80 kilobytes before simplification, but that takes too much time on such an expression. But since I'm trying to understand what this circuit does to the sound, and to recreate it, the form above will do.
     
  12. FLWrd

    Thread Starter New Member

    Jun 1, 2013
    10
    0
    Thanks for clearing that up.
     
  13. WBahn

    Moderator

    Mar 31, 2012
    17,720
    4,788
    And remember, a pint's a pound the world around! :D
     
  14. The Electrician

    AAC Fanatic!

    Oct 9, 2007
    2,281
    326
    If you multiply these two you should get the overall transfer function. Have you tried this? Do you have reason to believe the result is wrong?
     
  15. FLWrd

    Thread Starter New Member

    Jun 1, 2013
    10
    0
    Perhaps you missed it, but I had already found out that multiplying gets what seems to be the right answer. However, I was taught that you can't just multiply transfer functions. I know that under certain conditions multiplication gives a decent approximation, which seems to be the case here. But the thing that had me stumped was that solving the set of equations for the whole system produces a wrong result, so I was interested to learn why that is...
     
  16. The Electrician

    AAC Fanatic!

    Oct 9, 2007
    2,281
    326
    This is one of those cases where you can multiply and the result is exactly the same as solving the whole system. It's because of the fact that the first opamp is taken to have zero output impedance due to the 100% negative feedback, so the second stage doesn't load the first.

    I get exactly the same result when I solve the whole system, so you have apparently made a mistake when you attempt the same.

    To try to help you find out why your whole system solution doesn't work, you may have to show more of your work.

    In post #3 you said "It's partially automated...". What did you mean by that?

    Assuming you get your equations set up properly, how do you solve them?
     
  17. The Electrician

    AAC Fanatic!

    Oct 9, 2007
    2,281
    326
    One thing I notice in post #3 is that in going from the equation in red:

    "It's in particular equation 5 (in another form: Vd * (1/C5+1/R6) = Vb * 1/C5 - Ve * 1/R6, and in which I'm substituting Vc = Vd via equation 0) that I'm a bit suspicious of."

    to equation 5:

    5. Vd * (R6+C5) - Vb * R6 - Ve * C5 = 0

    you've made a sign error.

    But, besides that, an equation such as:

    Vd * (1/C5+1/R6) = Vb * 1/C5 - Ve * 1/R6

    is not a good nodal equation (assuming you're trying for a nodal method solution). Nodal equations should be multiplying node voltages by admittances, or sums of admittances. A term like 1/R6 is an admittance, but 1/C5 is not.

    You should have something like Vd * (s C5+1/R6), not Vd * (1/C5+1/R6).

    If you did this sort of thing (as shown in post #3), I don't understand how you got the correct solution for the individual stages.

    Show your equations for the whole system in proper nodal form and that should help us track down your error.
     
  18. FLWrd

    Thread Starter New Member

    Jun 1, 2013
    10
    0
    That's the kind of knowledge that I'm lacking. My electronics education was very theoretical, and a long, long time ago.
    And you've clearly found the error too.
    That's pretty serious. But I don't completely get why that is the case. Is it because I have to consider that the Vb-C5-Vd-R6-Ve acts like a voltage divider?
    I have written a script that compiles the equations from a netlist like data structure, and then feeds it into a matrix solver. The matrix solver is correct, AFAIK, but if it feeds it the wrong equations, well...

    BTW, I'm assuming the usual transformation, so C5 is actually a function 1/(C5*s), where s=jω. For the matrix solver I then turn (1/Z1+1/Z2) into (Z1+Z2)/(Z1*Z2).
     
  19. WBahn

    Moderator

    Mar 31, 2012
    17,720
    4,788
    It's not JUST Equation #5. Of your eight equations, the last 6 are simply WRONG! None of them are dimensionally consistent. So it is not surprising that you get a wrong result.

    You need to first set up the equations properly. There really isn't much point to looking at anything else until you have done that.
     
  20. The Electrician

    AAC Fanatic!

    Oct 9, 2007
    2,281
    326
    It's a simple algebra error. Let's look at it step by step. Start with this equation:

    Vd * (1/C5+1/R6) = Vb * 1/C5 - Ve * 1/R6

    When you move the red part to the left of the "=" sign, you change the sign and get:

    Vd * (1/C5+1/R6) -Vb * 1/C5 = - Ve * 1/R6

    Now you move the remaining red part to the left and change its sign:

    Vd * (1/C5+1/R6) - Vb * 1/C5 + Ve * 1/R6 = 0

    I have to say that this is a really bad practice. It's what WBahn is on about because it makes someone who doesn't know that you're going to make this "transformation" think you have a problem with units. You shouldn't use the symbol C5 to mean one thing at one moment, and then something else later.
     
Loading...