Question about getting the transfer function with two opamps

Thread Starter

FLWrd

Joined Jun 1, 2013
10
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
Can you explain me why this is the correct equation? I understand the steps, but I thought that the correct equation was (Vd-Vb)*(C5*s)+(Vd-Ve)/R6=0, i.e. the sum of the currents is just 0. That makes Vd positive in my equation and Vb and Ve negative.
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.
Ok, I understand this is the standard. It's just that I learned to write them with Z's (e.g. Vx*(1/Z1+1/Z2) - Vy*(1/Z2) = 0), and (wrongly) assumed that R and C were just conventions to make it easier to relate the symbols to the actual components. I believe I have formatted them properly this time:
Rich (BB code):
0. Vd - Vc = 0
1. Vout - Vf = 0
2. Va * (R4+R2+s*R2*C2*R4) / (R2*R4) - Vin / R2 - Vb / R4 = 0
3. Vb * (R5+R4+s*R4*C5*R5) / (R4*R5) - Va / R4 - Vd * (s*C5) - Vc / R5 = 0
4. Vc * (1+s*R5*C4) - Vb = 0
5. Vd * (1+s*C5*R6) / R6 - Vb * (s*C5) - Ve / R6 = 0
6. Ve * (R7+R6+s*R6*C7*R7) / (R6*R7) - Vd / R6 - Vout * (s*C7) - Vf / R7 = 0
7. Vf * (1+s*R7*C6) - Ve = 0
But I still have the sign error.

By the way, do I see this correctly: if the overall transfer function is a multiplication of the transfer functions of the two separate filters, then Vd is like a source for the second stage?
 

WBahn

Joined Mar 31, 2012
30,058
By convention, Z is impedance and R and C (and L) are resistances and capacitances (and inductances).

If you use R and C for other things it causes confusion (as is the case here). This is especially true if you also use them for their normal interpretation someplace else in your work (as is the case here). Sooner or later you are going to confuse yourself and make a total hash of things. If you track your units in your work, you will most likely catch it, but if you don't then you will blindly end up with a wrong answer and be left wondering why (assuming you even realize it).

Remember that you can always use meaningful subscripts on things.

Z_C5 (or just ZC5, if you prefer) will almost certainly be interpretted as being the impedance of C5 such that

Z_C5 = 1/(sC5)
 

The Electrician

Joined Oct 9, 2007
2,970
Can you explain me why this is the correct equation? I understand the steps, but I thought that the correct equation was (Vd-Vb)*(C5*s)+(Vd-Ve)/R6=0, i.e. the sum of the currents is just 0. That makes Vd positive in my equation and Vb and Ve negative.
Until now, I haven't bothered to see if your equations are correct. When I see an error, I mention it and wait for the person I'm helping to correct it. Oftentimes, that one error is all there is.

In this case, let's look at what you're doing. You have apparently started with the usual form for a nodal analysis, which is to write a sum of fractions. The numerator is a voltage across an impedance, and the denominator is that impedance. It would be easier for me to see what you're doing if you leave your equations in that form. You could go as far as collecting terms so that each equation is a sum of terms, each term having a numerator which is a single node voltage, and a denominator which is an impedance.

For example, summing currents at node b you will have:

(Vb-Va)/R4 + (Vb-Vc)/R5 + (Vb-Vd)/ZC5 = 0

substituting 1/(s C5) for ZC5, we get:

(Vb-Va)/R4 + (Vb-Vc)/R5 + (Vb-Vd)*(s C5) = 0

Now, if you collect terms for each node voltage you get:

Va*(-1/R4) + Vb*(1/R4 + 1/R5 + s C5) + Vc*(-1/R5) + Vd*(-s C5) = 0

If you leave your equations in this form (don't clear the fractions), you have the standard form for a matrix solver--node voltages multiplied by coefficients which are sums of admittances. If you have your equations in that form, it's easier (for me, at least) to compare to the way I do it (the standard formulation).

Ok, so on to the next problem. You can't get an equation by applying KCL to the output of an ideal opamp, which is what you're trying to do at node Vd. At a node which is connected to a voltage source, which is what the output of an ideal opamp is, you have to just use a constraint equation. The appropriate constraint is Vc -Vd = 0. Even if you could form a KCL equation there, you forgot to include the current from the opamp output.

Ok, I understand this is the standard. It's just that I learned to write them with Z's (e.g. Vx*(1/Z1+1/Z2) - Vy*(1/Z2) = 0), and (wrongly) assumed that R and C were just conventions to make it easier to relate the symbols to the actual components. I believe I have formatted them properly this time:
Rich (BB code):
0. Vd - Vc = 0
1. Vout - Vf = 0
2. Va * (R4+R2+s*R2*C2*R4) / (R2*R4) - Vin / R2 - Vb / R4 = 0
3. Vb * (R5+R4+s*R4*C5*R5) / (R4*R5) - Va / R4 - Vd * (s*C5) - Vc / R5 = 0
4. Vc * (1+s*R5*C4) - Vb = 0
5. Vd * (1+s*C5*R6) / R6 - Vb * (s*C5) - Ve / R6 = 0
6. Ve * (R7+R6+s*R6*C7*R7) / (R6*R7) - Vd / R6 - Vout * (s*C7) - Vf / R7 = 0
7. Vf * (1+s*R7*C6) - Ve = 0
But I still have the sign error.
I would let the equations be:

1. Va * (R4+R2+s*R2*C2*R4) / (R2*R4) - Vin / R2 - Vb / R4 = 0
2. Vb * (R5+R4+s*R4*C5*R5) / (R4*R5) - Va / R4 - Vd * (s*C5) - Vc / R5 = 0
3. Vc * (1+s*R5*C4) - Vb = 0
4. Vd * (1+s*C5*R6) / R6 - Vb * (s*C5) - Ve / R6 = 0
5. Vd - Vc = 0
6. Ve * (R7+R6+s*R6*C7*R7) / (R6*R7) - Vd / R6 - Vout * (s*C7) - Vf / R7 = 0
7. Vf * (1+s*R7*C6) - Ve = 0
8. Vout - Vf = 0

This gives you 8 equations in 8 unknowns. I haven't checked them for correctness, because they aren't in the standard form and I don't feel like doing the work to convert my equations to the form your equations are in. But they look alright; they each involve the right nodes. Try solving this system and see what you get.


By the way, do I see this correctly: if the overall transfer function is a multiplication of the transfer functions of the two separate filters, then Vd is like a source for the second stage?
Yes. Not only is Vd like a source, it is a source.
 

vk6zgo

Joined Jul 21, 2012
677
And remember, a pint's a pound the world around! :D
NO! "A pint of clear water weighs a pound & a quarter!"

You have a "rationalised" system of weights & measures.

The old "Imperial" system is not rationalised,so that a US "55gal" drum is the same as a "44gal" drum in most of the British Commonwealth countries.(a big part of the "world around".)

Metric makes it easy,as both are "200 litre" drums!
 

WBahn

Joined Mar 31, 2012
30,058
NO! "A pint of clear water weighs a pound & a quarter!"

You have a "rationalised" system of weights & measures.

The old "Imperial" system is not rationalised,so that a US "55gal" drum is the same as a "44gal" drum in most of the British Commonwealth countries.(a big part of the "world around".)

Metric makes it easy,as both are "200 litre" drums!
Uhm... you did see the big smiley, right? That was a meant as a tongue-in-cheek comment in the vein of the sub-discussion going on. Of course, maybe your first sentence was, too. I notice that you quoted the statement, but I have never heard the saying.

And, no, a pint of clear water is NOT a pound and a quarter (though I am assuming you are using an international avoidupois pound (the most common) and a U.S. pint -- if other, please specify, I'd be quite interested). A gallon of pure water is right at 8.33lb (avoidupois), making a pint equal to right about 1.04lb.

A U.S. gallon is defined as 231 cubic inches (exactly) and an inch is defined as 2.54 cm (exactly). Thus a pint, of which there are 8 in a gallon, is 473.176473 cubic centimeters (exactly).

The pound (or, more specifically, the international avoirdupois pound) is defined as 0.45359237 kg (exactly).

The density of water is not exact, but at STP it is about 999.1 kg/m^3 and reaches a maximum of about 999.97 kg/m^3 at just under 4°C. So it's entirely reasonable to use 1000 kg/m^3 and cull our work to three or four sig figs.

So a pint of pure water weighs 1.043 lb (and is actually always just a tiny bit less, but under reasonably normal conditions not by more than about 0.1%).

As for the names and actual capacities of things like "drums" and "barrels" (and lots of others), that is a truly tangled web. In many cases you have to know the specific context of usage -- for instance, it's not enough to know that you are talking about alcoholic beverages, you have to know what kind of alcoholic beverages, distilled liquor, wine, or beer. Even your "200L" drum is not 200L, but rather about 208L, or more than 5% larger. The actual capacities are more typically about 218L (so about 10% larger) but they are commonly filled to just a little over 200L (~202L or about 1% over). But "200L" is a quite reasonable nominal size (and note that "nominal" does NOT mean "optimal", but rather "by name").

And I definitely agree that, for most purposes, the metric system is far superior.
 
Last edited:

vk6zgo

Joined Jul 21, 2012
677
Uhm... you did see the big smiley, right? That was a meant as a tongue-in-cheek comment in the vein of the sub-discussion going on. Of course, maybe your first sentence was, too. I notice that you quoted the statement, but I have never heard the saying.

And, no, a pint of clear water is NOT a pound and a quarter (though I am assuming you are using an international avoidupois pound (the most common) and a U.S. pint -- if other, please specify, I'd be quite interested). A gallon of pure water is right at 8.33lb (avoidupois), making a pint equal to right about 1.04lb.

A U.S. gallon is defined as 231 cubic inches (exactly) and an inch is defined as 2.54 cm (exactly). Thus a pint, of which there are 8 in a gallon, is 473.176473 cubic centimeters (exactly).

The pound (or, more specifically, the international avoirdupois pound) is defined as 0.45359237 kg (exactly).

The density of water is not exact, but at STP it is about 999.1 kg/m^3 and reaches a maximum of about 999.97 kg/m^3 at just under 4°C. So it's entirely reasonable to use 1000 kg/m^3 and cull our work to three or four sig figs.

So a pint of pure water weighs 1.043 lb (and is actually always just a tiny bit less, but under reasonably normal conditions not by more than about 0.1%).

As for the names and actual capacities of things like "drums" and "barrels" (and lots of others), that is a truly tangled web. In many cases you have to know the specific context of usage -- for instance, it's not enough to know that you are talking about alcoholic beverages, you have to know what kind of alcoholic beverages, distilled liquor, wine, or beer. Even your "200L" drum is not 200L, but rather about 208L, or more than 5% larger. The actual capacities are more typically about 218L (so about 10% larger) but they are commonly filled to just a little over 200L (~202L or about 1% over). But "200L" is a quite reasonable nominal size (and note that "nominal" does NOT mean "optimal", but rather "by name").

And I definitely agree that, for most purposes, the metric system is far superior.
Sorry,I should have made it clear that I was referring to an Imperial pint,which is larger than a US pint.

An Imperial pint is very close to 1.25 times a US pint,(& ,if it is water,weighs 1.25 lb),hence,the little rhyme I quoted,which was printed on the back cover of the "Exercise Books" we used at School back in the day.

This why I took issue with "the world around" in your rhyme!:D

Accordingly,all the other liquid measurements from that size up are larger by the same factor,hence,44gal (IMP) is exactly the same drum as 55gal (US).(& the actual quantities are very close,too.)

As far as I know,this is the only case where US & Imperial measures differ.
 
Last edited:

WBahn

Joined Mar 31, 2012
30,058
Thanks for the clarification and the information. I've run across Imperial gallons from time to time, but don't spend a lot of time thinking about them. It appears that 1 Imp gallon is right at 1.2 U.S. gallon (so one and a quarter is a useful approximation).

The more frustrating thing, for me, is the use of the same name, ounce, for both a measure of weight and a measure of volume. They are two different measures that just happen to use the same name, but many, many people don't grasp that and use them interchangeably. Worse, sometimes you can't tell from the context which was meant.
 

Thread Starter

FLWrd

Joined Jun 1, 2013
10
Hi, I've finally come back to solving this:
I would let the equations be:
1. Va * (R4+R2+s*R2*C2*R4) / (R2*R4) - Vin / R2 - Vb / R4 = 0
2. Vb * (R5+R4+s*R4*C5*R5) / (R4*R5) - Va / R4 - Vd * (s*C5) - Vc / R5 = 0
3. Vc * (1+s*R5*C4) - Vb = 0
4. Vd * (1+s*C5*R6) / R6 - Vb * (s*C5) - Ve / R6 = 0
5. Vd - Vc = 0
6. Ve * (R7+R6+s*R6*C7*R7) / (R6*R7) - Vd / R6 - Vout * (s*C7) - Vf / R7 = 0
7. Vf * (1+s*R7*C6) - Ve = 0
8. Vout - Vf = 0
Thanks. These equations produce a transfer function that resembles the product of the TFs of the two independent filters, but not completely, which I guess is what I was looking for. I've attached a plot of the two. The highest one (red, I think) with the peak around 8kHz is the one produced by the above equations, the other one (black) is the product of two TFs.

I've compared the equations to my original ones, and I don't understand why equation 4 is the way it is. There is something lacking in my understanding of opamps. I did read the chapter on opamps of my old text book on electronics (Ralph Smith, Electronics, Circuits and Devices, 1980) again, and I tried the model of an opamp that it gives (http://commons.wikimedia.org/wiki/File:Op-Amp_Internal.svg), but that didn't help either. Would you have another pointer?
 

Attachments

Let me check out each equation. If I leave them in standard form for nodal analysis, I get this, moving from left to right:

1. (Vin - Va)/R2 = 0
2. (Va - Vin)/R2 + Va/(1/(s C2)) + (Va - Vb)/R4 = 0
3. (Vb - Va)/R4 + (Vb - Vd)/(1/(s C5)) + (Vb - Vc)/R5 = 0
4. (Vc - Vb)/R5 + Vc/(1/(s C4)) = 0
5. Vd - Vc = 0
6. (Ve - Vd)/R6 + (Ve - Vout)/(1/(s C7)) + (Ve - Vf)/R7 = 0
7. (Vf - Ve)/R7 + Vf/(1/(s C6)) = 0
8. Vout - Vf = 0

After clearing some fractions, I get:

1. Vin/R2-Va/R2=0
2. Va * (R4+R2+s*R2*C2*R4) / (R2*R4) - Vin / R2 - Vb / R4 = 0
3. Vb * (R5+R4+s*R4*C5*R5) / (R4*R5) - Va / R4 - Vd * (s*C5) - Vc / R5 = 0
4. Vc * (1+s*R5*C4) - Vb = 0
5. Vd - Vc = 0
6. Ve * (R7+R6+s*R6*C7*R7) / (R6*R7) - Vd / R6 - Vout * (s*C7) - Vf / R7 = 0
7. Vf * (1+s*R7*C6) - Ve = 0
8. Vout - Vf = 0

This is more the form you have them in.

You should go through your equations again very carefully.

These are in slightly different order and with a couple of differences compared to the equations that you have.

If I collect terms and put them in matrix form I get:

 

Attachments

Thread Starter

FLWrd

Joined Jun 1, 2013
10
Let me check out each equation. If I leave them in standard form for nodal analysis, I get this, moving from left to right:
Hi.

First of all: I hadn't seen there were replies to this message. Perhaps it ended in my spam box, and I deleted it without noticing.

Second: thank you. Especially combined with the remark that an opamp is a source, I finally see what I've been doing wrong. If I summarize properly, it's that I treated (the output of) the opamp as an ordinary, "passive" element with infinite resistance, whereas for nodal analysis, it sort of blocks any current flow. Now I have consistent results, although actual measurements show that there is some other filter in the device as well, but that's another story.

Thanks!
 
Top