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

Sam Chak
Sam Chak 2025년 3월 26일
이동: Sam Chak 2025년 3월 26일
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 2025년 3월 26일
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 2025년 3월 26일
@Napath Is this a type of transfer function?
Napath
Napath 2025년 3월 26일
편집: Napath 2025년 3월 26일
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.

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2025년 3월 26일

1 개 추천

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

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

질문:

2025년 3월 26일

댓글:

2025년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by