# Solve a group of Symbolic Equations

9 vues (au cours des 30 derniers jours)
Matthew Worker le 25 Fév 2023
Modifié(e) : Dyuman Joshi le 25 Fév 2023
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?
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

Dyuman Joshi le 25 Fév 2023
Modifié(e) : Dyuman Joshi le 25 Fév 2023
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 =
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Plus de réponses (1)

Walter Roberson le 25 Fév 2023
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.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

R2022b

### Community Treasure Hunt

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

Start Hunting!

Translated by