How to solve a set of symbolic equations for the same variable?

1 visualización (últimos 30 días)
Diaa
Diaa el 2 de En. de 2021
Comentada: Diaa el 7 de En. de 2021
Is there a way to make the following work and solve the following set of symbolic equations for the same variable and save the output in an array?
syms x a
eqns = [a==x+2, a==5*x];
xvalues = vpasolve( subs(eqns,a,[1,2]) , [x,x] );
  1 comentario
Star Strider
Star Strider el 2 de En. de 2021
I do not believe any solution exists to those equations, especially after the subs call.

Iniciar sesión para comentar.

Respuestas (1)

fouad koudsi
fouad koudsi el 7 de En. de 2021
Becasue you hava two equations with two unknowns (x & a), so you will not need to substitute any value for a:
code:
syms x a
eqns = [a==x+2 a==5*x]
[xsol asol]=solve(eqns,[x a])
  1 comentario
Diaa
Diaa el 7 de En. de 2021
It accidentally happens to have two equations of two variables in my question, but how about that?
syms x a
eqns = [a==5*x];
xvalues = vpasolve( subs(eqns,a,[1,2,3,4]) , repel(x,4) );

Iniciar sesión para comentar.

Categorías

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

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by