Simplify the V/I equation

12 views (last 30 days)
Napath
Napath on 26 Mar 2025
Commented: Walter Roberson on 27 Mar 2025
I want to determine V/I (voltage/current) symbolically from the equation using solve function, but the answer that I got from it is just V not V/I.
This is my code:
clear Vx Vy Vcm Cin Ca Cfb Ccm s x y gm Zin solx soly
syms Vx Vy Vo Cin Ca Cfb Ccm s x y gm Zin Vcm
eqns = [2*((Cin*(Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)) + (y*((2*Ca)/Cfb + 1))/(2*Ca*s))*((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1))/(Ca*(((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1) + 1)) - (y*((2*Ca)/Cfb + 1))/(2*Ca*s) - Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)))*s*Ccm+2*x*s*Cin==(-((Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)) + (y*((2*Ca)/Cfb + 1))/(2*Ca*s))*(Cfb/(2*Ccm) + 1))/(((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1) + 1))*(2/Zin+2*s*Cin+2*s*Ccm)];
S = solve(eqns);
sol = [S]
sol = 
x is V (voltage) and y is I (current). You can see that it still have variable y in the answer. I want y to be at left hand side. Is there any way to do it?
  6 Comments
Sam Chak
Sam Chak on 26 Mar 2025
If the equation eqn is correctly described, we should observe the following form:
.
This implies that the two terms can be separated into:
.
However, I do not see this form in your equation. Moreover, the transfer function should be properly derived from the governing differential equations. However, this important step has been overlooked, and you immediately introduce the algebraic equation, eqn.
syms Vx Vy Vo Cin Ca Cfb Ccm s x y gm Zin Vcm
eqn = [2*((Cin*(Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)) + (y*((2*Ca)/Cfb + 1))/(2*Ca*s))*((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1))/(Ca*(((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1) + 1)) - (y*((2*Ca)/Cfb + 1))/(2*Ca*s) - Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)))*s*Ccm+2*x*s*Cin==(-((Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)) + (y*((2*Ca)/Cfb + 1))/(2*Ca*s))*(Cfb/(2*Ccm) + 1))/(((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1) + 1))*(2/Zin+2*s*Cin+2*s*Ccm)]
eqn = 
% ySol = isolate(eqn, y)
Walter Roberson
Walter Roberson on 26 Mar 2025
syms Vx Vy Vo Cin Ca Cfb Ccm s x y gm Zin Vcm
eqns = [2*((Cin*(Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)) + (y*((2*Ca)/Cfb + 1))/(2*Ca*s))*((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1))/(Ca*(((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1) + 1)) - (y*((2*Ca)/Cfb + 1))/(2*Ca*s) - Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)))*s*Ccm+2*x*s*Cin==(-((Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)) + (y*((2*Ca)/Cfb + 1))/(2*Ca*s))*(Cfb/(2*Ccm) + 1))/(((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1) + 1))*(2/Zin+2*s*Cin+2*s*Ccm)];
size(eqns)
ans = 1×2
1 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
You have a scalar equation. When you solve() a system of equations and do not specify which variable to solve for, it uses symvar() to choose one of the variables out of the set. Most likely it will solve for x in this situation, which might not be what you want.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 26 Mar 2025
Use the usual trick of substition of variables. If x/y = z then it follows that x = y*z so substitute in y*z for x and solve for z
syms Vx Vy Vo Cin Ca Cfb Ccm s x y gm Zin Vcm
syms Z
eqns = [2*((Cin*(Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)) + (y*((2*Ca)/Cfb + 1))/(2*Ca*s))*((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1))/(Ca*(((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1) + 1)) - (y*((2*Ca)/Cfb + 1))/(2*Ca*s) - Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)))*s*Ccm+2*x*s*Cin==(-((Vcm*((2*Ca)/Cfb - ((2*Ca)/Cfb + 1)*(Cin/Ca + 1)) + (y*((2*Ca)/Cfb + 1))/(2*Ca*s))*(Cfb/(2*Ccm) + 1))/(((2*Ca)/Cfb + 1)*(Cfb/(2*Ccm) + 1) + 1))*(2/Zin+2*s*Cin+2*s*Ccm)];
eqns1 = subs(eqns, x, y*Z);
S = solve(eqns1, Z)
S = 
eqn2 = x/y == simplify(S)
eqn2 = 
  2 Comments
Torsten
Torsten on 27 Mar 2025
The right-hand side of eqn2 still depends on y.
Walter Roberson
Walter Roberson on 27 Mar 2025
If the right hand side is not intended to depend on y, then the equations are incorrect.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!