How to solve a set of symbolic equations for the same variable?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Star Strider
2021년 1월 2일
I do not believe any solution exists to those equations, especially after the subs call.
답변 (1개)
fouad koudsi
2021년 1월 7일
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])
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!