Collect the coefficients of a symbolic expression for an Op Amp circuit function

2 views (last 30 days)
Hello,
I have writen function for Op Amp Sallen-Key Circuit. All values including the 's' are used as symbolic expresion.
I would need to rearange the variables in order to have on the left side the V2/V1. I have been trying to use solve(V2,V1) but are not rearanged.
On the right side I would need the denominator to be on the form of . I have been trying with factor(G) but it gives denominator on the form of .
Is there any way to achieve the above.
Giannis

Accepted Answer

Dyuman Joshi
Dyuman Joshi on 29 Jul 2023
syms A Ga Gb G1 G2 C2 V1 V2 s
%Defining expression
expr = V2 == A*((G1*G2*V1 + C2*G2*V2*s)/(C2^2*s^2+G1*G2 + C2*G1*s + 2*C2*G2*s) - Gb*V2/(Ga+Gb))
expr = 
%Isolating V2 to LHS
expr = isolate(expr,V2)
expr = 
%Assuming that V2/V1 can isolated from the expression
%Dividing both sides of the expression by V1 to obtain V2/V1 on the left side
expr = expr/V1
expr = 
If you want to simplify the RHS, this approach works good enough -
%Get numerator and denominator of RHS in a rational form
[n,d] = numden(rhs(expr))
n = 
d = 
%Redefine the expression
expr = lhs(expr) == n/d
expr = 
If you want the coefficient of s^2 in the denominator to be 1, get its coefficient by using coeffs and divide d by the coefficient.
  4 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!