I need to rewrite a symbolic expression in terms of a specific subexpression.
Consider the following scenario:
- expression
f
with 2 variablesa
,b
subexpression
c = a / b
syms a b c f = b / (a + b) % = 1 / (1 + a/b) = 1 / (1 + c) <- what I need
Is there a way to achieve this?
Edit:
The step from 1 / (1 + a/b)
to 1 / (1 + c)
can be achieved by calling
subs(1 / (1 + a/b),a/b,c)
So a better formulated question is:
Is there a way to tell MATLAB to 'simplify' b / (a + b)
into 1 / (1 + a/b)
?
Just calling simplify(b / (a + b)
makes no difference.