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

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 Kommentar

I do not believe any solution exists to those equations, especially after the subs call.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

fouad koudsi
fouad koudsi am 7 Jan. 2021

0 Stimmen

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 Kommentar

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) );

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020b

Gefragt:

am 2 Jan. 2021

Kommentiert:

am 7 Jan. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by