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 commentaires

Sam Chak
Sam Chak le 26 Mar 2025
Déplacé(e) : Sam Chak le 26 Mar 2025
Perhaps using the isolate() function, so that the variable y appears on the left side.
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)];
ySol = isolate(eqn, y)
ySol = 
Napath
Napath le 26 Mar 2025
Thank you for the response! I want the left side to be x/y (V/I) is there any way? or can I just use sol/ysol?
Sam Chak
Sam Chak le 26 Mar 2025
@Napath Is this a type of transfer function?
Napath
Napath le 26 Mar 2025
Modifié(e) : Napath le 26 Mar 2025
Kind of, the s is represent factor in frequency domain. I want to get the Zin (Vin/Iin) from my circuit.
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)
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.

Connectez-vous pour commenter.

 Réponse acceptée

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 commentaires

Torsten
Torsten le 27 Mar 2025
The right-hand side of eqn2 still depends on y.
Walter Roberson
Walter Roberson le 27 Mar 2025
If the right hand side is not intended to depend on y, then the equations are incorrect.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by