TransWikia.com

How to simplify an expression to a variable?

Mathematica Asked on May 1, 2021

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

One Answer

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)

Correct answer by John Doty on May 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP