Rev 1232 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1232 | Rev 1233 | ||
---|---|---|---|
Line 9... | Line 9... | ||
9 | 9 | ||
10 | 10 | ||
11 | def calc_mfb_lowpass(): |
11 | def calc_mfb_lowpass(): |
12 | 12 | ||
13 | # as in sloa049, fig.7-1 |
13 | # as in sloa049, fig.7-1 |
14 | r1,r2,r3,c1,c2 = symbols('r1 r2 r3 c1 c2') |
14 | r1,r2,r3,c1,c2 = symbols('r1 r2 r3 c1 c2', real=True, positive=True) |
15 | 15 | ||
16 | # v is input voltage, u is output, x is voltage at r1/c2/r2/r3 node |
16 | # v is input voltage, u is output, x is voltage at r1/c2/r2/r3 node |
17 | u,v,x = symbols('u v x') |
17 | u,v,x = symbols('u v x') |
18 | 18 | ||
19 | # currents through appropriate elements. |
19 | # currents through appropriate elements. |
20 | # ir1,ir2,ir3 flow into the node x, |
20 | # ir1,ir2,ir3 flow into the node x, |
21 | # ic2 flows out of the node x |
21 | # ic2 flows out of the node x |
22 | ir1,ic2,ir2,ir3 = symbols('ir1,ic2,ir2,ir3') |
22 | ir1,ic2,ir2,ir3 = symbols('ir1,ic2,ir2,ir3') |
23 | 23 | ||
24 | # angular frequency (omega) |
24 | # angular frequency (omega) |
25 | w = symbols('w') |
25 | w = symbols('w', real=True, positive=True) |
26 | 26 | ||
27 | # make set of equations to calculate H |
27 | # make set of equations to calculate H |
28 | # |
28 | # |
29 | # current through r1 |
29 | # current through r1 |
30 | h_eq1 = Eq( ir1, (v-x)/r1 ) |
30 | h_eq1 = Eq( ir1, (v-x)/r1 ) |
Line 59... | Line 59... | ||
59 | 59 | ||
60 | 60 | ||
61 | 61 | ||
62 | # now make more substitutions |
62 | # now make more substitutions |
63 | # |
63 | # |
64 | k,wc,q,h = symbols('k wc q h') |
64 | h = symbols('h') |
- | 65 | k = symbols('k', real=True, negative=True) |
|
- | 66 | q,wc = symbols('q wc', real=True, positive=True) |
|
65 | # |
67 | # |
66 | # filter gain |
68 | # filter gain |
67 | s_eq1 = Eq( k, -r2/r1 ) |
69 | s_eq1 = Eq( k, -r2/r1 ) |
68 | # |
70 | # |
69 | # cutoff angular frequency |
71 | # cutoff angular frequency |
70 | s_eq2 = Eq( wc, 1/sqrt(r2*r3*c1*c2) ) |
72 | s_eq2 = Eq( wc, 1/sqrt(r2*r3*c1*c2) ) |
71 | # |
73 | # |
72 | # quality |
74 | # quality |
73 | s_eq3 = Eq( q, sqrt(r2*r3*c1*c2)/(r3*c1+r2*c1-r3*c1*k) ) |
75 | s_eq3 = Eq( q, sqrt(r2*r3*c1*c2)/(r3*c1+r2*c1-r3*c1*k) ) |
- | 76 | #s_neq3 = Lt( k, 0 ) |
|
74 | # |
77 | # |
75 | # new H expression |
78 | # new H expression |
76 | s_eq4 = Eq( h, h_expr ) |
79 | s_eq4 = Eq( h, h_expr ) |
77 | 80 | ||
78 | # solve |
81 | # solve |
Line 84... | Line 87... | ||
84 | 87 | ||
85 | h_expr = h_solve[0] |
88 | h_expr = h_solve[0] |
86 | h_result = h_expr[h] |
89 | h_result = h_expr[h] |
87 | 90 | ||
88 | init_printing() |
91 | init_printing() |
- | 92 | print('') |
|
89 | pprint(h_expr) |
93 | pprint(h_expr) |
- | 94 | print('') |
|
90 | pprint(h_result) |
95 | pprint(h_result) |
91 | 96 | ||
92 | #breakpoint() |
97 | #breakpoint() |
93 | 98 | ||
94 | 99 |