EDIT: I created an example to specify my problem in more detail.
I want to substitute variables in an equation system. Here an example to illustrate my idea:
syms f(x) z(x)
fun1 = f == (x+4)^2 + 4;
fun2 = f == x^2+8*x+20;
transform = z == (x+4)^2;
subs(fun1, rhs(transform), lhs(transform))
subs(fun2, rhs(transform), lhs(transform))
Obviously, fun1 and fun2 are the same. However Matlab is not able to replace the expression for z correctly when given in the form of fun2. Is there a way to achieve the same result in both notations?
Thank you for your help in advance.