From: Andy Yancy on
Say I have symbolic variables declared like this

syms a b;

and some functions declared like this

foo = inline('r - s + 10', 'r', 's');
bar = inline('t + u + 20', 't', 'u');

I want to be to do something like

simplify(foo(a, bar(a, b)))

and get the result

-b - 10

What's the easiest way to take advantage of Matlab's symbolic capabilities to do something like this? Is it just a matter of clever use of Matlab's subs function when I call my foo and bar functions from inside simplify? Thanks for any help!