필터 지우기
필터 지우기

use the "subs" command to subsitute equations for a variable

조회 수: 1 (최근 30일)
Philosophaie
Philosophaie 2013년 9월 20일
Here is a silly question: is there a way to use the "subs" command to subsitute equations for a variable?
eqn = 2*(2*x-1) + 3*(3*x+2) + 4*(4*x-5)=11
eqn1 = subs(eqn, {2*x-1,3*x+2,4*x-5}, {a,b,c}); ???
The result:
2*a+3*b+4*c=11 ???
  댓글 수: 3
Philosophaie
Philosophaie 2013년 9월 20일
Simplify the viewing of large equation.
Walter Roberson
Walter Roberson 2013년 9월 20일
It makes a difference as to whether the expressions appear exactly, or if instead you want an algebraic transformation. For example if the code had 2*x-2 and you substituted 2*x-1 -> a, then would you want the result to be a-1 or would you want the substitution to be skipped ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 20일
syms x a
y=2*(2*x-1);
subs(y,a)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by