MATLAB Answers

0

How to Customize Sigma in subexpr()?

Asked by Aoi Midori on 17 Apr 2019
Latest activity Commented on by Aoi Midori on 17 Apr 2019
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?

  0 Comments

Sign in to comment.

1 Answer

Answer by madhan ravi
on 17 Apr 2019
 Accepted Answer

subs(eqn2,sigma,k1+k2)

  1 Comment

Thank you for your quick response. It worked!

Sign in to comment.