Solve a group of Symbolic Equations

5 visualizaciones (últimos 30 días)
Matthew Worker
Matthew Worker el 25 de Feb. de 2023
Editada: Dyuman Joshi el 25 de Feb. de 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?

Respuesta aceptada

Dyuman Joshi
Dyuman Joshi el 25 de Feb. de 2023
Editada: Dyuman Joshi el 25 de Feb. de 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 = 

Más respuestas (1)

Walter Roberson
Walter Roberson el 25 de Feb. de 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.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by