Solve a group of Symbolic Equations

5 ビュー (過去 30 日間)
Matthew Worker
Matthew Worker 2023 年 2 月 25 日
編集済み: Dyuman Joshi 2023 年 2 月 25 日
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 Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by