How to Customize Sigma in subexpr()?

조회 수: 2 (최근 30일)
Aoi Midori
Aoi Midori 2019년 4월 17일
댓글: Aoi Midori 2019년 4월 17일
Let's say we have a formula below
syms k1 k2
eqn2 = (k1+k2+1)^2+(k1+k2+1)+1;
and put 'eqn2' into subexpr() function,
[EQN2, sigma] = subexpr(eqn2)
then the answer would be as follows:
EQN2 = sigma^2 + sigma + 1
sigma = k1 + k2 + 1
However, this time, I would like the sigma to be k1 + k2.
Could I customize the sigma as I want? If it's yes, how could I replace it?

채택된 답변

madhan ravi
madhan ravi 2019년 4월 17일
subs(eqn2,sigma,k1+k2)
  댓글 수: 1
Aoi Midori
Aoi Midori 2019년 4월 17일
Thank you for your quick response. It worked!

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

추가 답변 (0개)

카테고리

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