Solve a group of Symbolic Equations

5 次查看(过去 30 天)
syms A B alpha beta % variable
syms R1 R2 C1 C2 % constant
eqn1 = A + B == 1/(R1*C1)
eqn1 = 
eqn2 = -A*beta-B*alpha == 0
eqn2 = 
eqn3 = alpha*beta == 1/(R1*C1*R2*C2)
eqn3 = 
eqn4 = (R1*C1+R1*C2+R2*C2)/(R1*C1*R2*C2) == -alpha-beta
eqn4 = 
[A,B,alpha,beta] = solve(eqn1,eqn2,eqn3,eqn4)
A = 
B = 
alpha = 
beta = 
A1 = simplify(A)
A1 = 
B1 = simplify(B)
B1 = 
alpha1 = simplify(alpha)
alpha1 = 
beta1 = simplify(beta)
beta1 = 
I want to get A1,B1,alpha1,beta1 represented only by constant (R1 R2 C1 C2). However, when I run the codes, the system gives me:
A1 =
1/(C1*(A + B))
1/(C1*(A + B))
B1 =
-(A^2*C1 + B^2*C1 - A*(C1*(A^2*C1 + B^2*C1 + 2*A*B*C1 + 4*A*B*C2))^(1/2) + B*(C1*(A^2*C1 + B^2*C1 + 2*A*B*C1 + 4*A*B*C2))^(1/2) + 2*A*B*C2)/(2*A*B*C1*C2*(A + B))
-(A^2*C1 + B^2*C1 + A*(C1*(A^2*C1 + B^2*C1 + 2*A*B*C1 + 4*A*B*C2))^(1/2) - B*(C1*(A^2*C1 + B^2*C1 + 2*A*B*C1 + 4*A*B*C2))^(1/2) + 2*A*B*C2)/(2*A*B*C1*C2*(A + B))
alpha1 =
((A + B)*((C1*(A^2*C1 + B^2*C1 + 2*A*B*C1 + 4*A*B*C2))^(1/2) + A*C1 - B*C1))/(2*B*(C1 + C2))
-((A + B)*((C1*(A^2*C1 + B^2*C1 + 2*A*B*C1 + 4*A*B*C2))^(1/2) - A*C1 + B*C1))/(2*B*(C1 + C2))
beta1 =
-((A + B)*((C1*(A^2*C1 + B^2*C1 + 2*A*B*C1 + 4*A*B*C2))^(1/2) + A*C1 - B*C1))/(2*A*(C1 + C2))
((A + B)*((C1*(A^2*C1 + B^2*C1 + 2*A*B*C1 + 4*A*B*C2))^(1/2) - A*C1 + B*C1))/(2*A*(C1 + C2))
What other codes should I add to solve this problem?

采纳的回答

Dyuman Joshi
Dyuman Joshi 2023-2-25
编辑:Dyuman Joshi 2023-2-25
You need to specify which variables are you solving for -
syms A B alpha beta % variable
syms R1 R2 C1 C2 % constant
eqn1 = A + B == 1/(R1*C1);
eqn2 = -A*beta-B*alpha == 0;
eqn3 = alpha*beta == 1/(R1*C1*R2*C2);
eqn4 = (R1*C1+R1*C2+R2*C2)/(R1*C1*R2*C2) == -alpha-beta;
[A0,B0,alpha0,beta0] = solve([eqn1,eqn2,eqn3,eqn4],[A, B, alpha, beta]);
A0
A0 = 
B0
B0 = 
alpha0
alpha0 = 
beta0
beta0 = 

更多回答(1 个)

Walter Roberson
Walter Roberson 2023-2-25
You have four equations in 8 unknowns. When you call solve() you should specify the names of the variables to solve for. solve() is not able to read the names of the variables you are assigning to in order to figure out which variables you want to solve for.

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by