1
$\begingroup$

So I'm doing some operations in Mathematica and I arrive to this expression:

Clear[ZC1, s, CC1, ZCR1, R1, KVL1, V1, I1, V2, I2, KVL2, R2, param, a, b, c, d, cond, aux, Tran1RC, Tran2RC, 
 R3, R4, CC3, Circuito, gain, Tfilter]; 

ZC1 = 1/(s*CC1)

ZCR1 = Simplify[(R1*ZC1)/(R1 + ZC1)]

KVL1 = V1 == ZCR1*I1 + V2; 

KVL2 = V2 == R2*(I1 + I2); 

param = a == V1/V2; 

cond = I2 == 0; 

aux = Solve[KVL1 && KVL2 && param && cond, {a, V1, V2, I2}]

a = a /. aux[[1]][[1]]

param = b == -(V1/I2); 

cond = V2 == 0; 

aux = Solve[KVL1 && KVL2 && param && cond, {b, V1, V2, I2}]

b = b /. aux[[1]][[1]]

param = c == I1/V2; 

cond = I2 == 0; 

aux = Solve[KVL1 && KVL2 && param && cond, {c, I1, V2, I2}]

c = c /. aux[[1]][[1]]

param = d == -(I1/I2); 

cond = V2 == 0; 

aux = Solve[KVL1 && KVL2 && param && cond, {d, I1, I2, V2}]

d = d /. aux[[1]][[1]]

Tran1RC = {{a, b}, {c, d}};

Tran1RC // MatrixForm

a = a /. {R1 -> R3, R2 -> R4, CC1 -> CC3}

b = b /. {R1 -> R3, R2 -> R4, CC1 -> CC3}

c = c /. {R1 -> R3, R2 -> R4, CC1 -> CC3}

d = d /. {R1 -> R3, R2 -> R4, CC1 -> CC3}

Tran2RC = {{a, b}, {c, d}};

Tran2RC // MatrixForm

Circuito = Simplify[Tran1RC.Tran2RC];

Circuito // MatrixForm

gain = Circuito[[1]][[1]] /. {CC3 -> 10 CC1, R2 -> R3 + R4}

Tfilter = Simplify[1/gain]

Now the final expression I want to simplify according to variable s meaning that I want to arrive with expression in powers of s (s^1 and s^2) both in the numerator and the denominator. Exactly how shall I do this?

EDIT: Put the full workable code

$\endgroup$
6
  • $\begingroup$ You should write your code. Not just copy an image. With your code will be more easy to help you. $\endgroup$
    – No name
    Aug 21 '20 at 15:53
  • $\begingroup$ @Cruz what difference does it make? What do you need more? $\endgroup$ Aug 21 '20 at 15:54
  • $\begingroup$ I think Expand[Together[your expression]] will do it, but it's too much work to try it out when you haven't posted copyable code. $\endgroup$
    – John Doty
    Aug 21 '20 at 16:00
  • 3
    $\begingroup$ Because it's polite to help us help you. Instead of expecting us to re-type your code, we can copy and paste what's in your post into our own copies of Mathematica, expediting any help you might get! $\endgroup$
    – march
    Aug 21 '20 at 16:01
  • $\begingroup$ @march you are right, I just assumed it was an easy thing to answer for people that are use Mathematica frequently. Anyway, how do I post code easily? Does Mathematica have an export code option? Thank you in advance for your help $\endgroup$ Aug 21 '20 at 16:10
3
$\begingroup$
Rfilter = Together[Tfilter];
Collect[Numerator[Rfilter], s]/Collect[Denominator[Rfilter], s]

yielding

(R3 R4 + R4^2 + 
 (CC1 R1 R3 R4 + 10 CC1 R3^2 R4 + CC1 R1 R4^2 + 10 CC1 R3 R4^2) s + 
 (10 CC1^2 R1 R3^2 R4 + 10 CC1^2 R1 R3 R4^2) s^2)
 /
 (2 R1 R3 + R3^2 + 2 R1 R4 + 2 R3 R4 + 
 R4^2 + 
(11 CC1 R1 R3^2 + 22 CC1 R1 R3 R4 + 10 CC1 R3^2 R4 + CC1 R1 R4^2 + 10 CC1 R3 R4^2) s + 
 (10 CC1^2 R1 R3^2 R4 + 10 CC1^2 R1 R3 R4^2) s^2)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.