I'm finding that passing symbolic functions only works if you use the same name for the symbolic variable both inside and outside the function.
For example, the function I'm writing is supposed to output a symbolic function g(T), given some input function f(T). If I go:
syms T;
f1(T)=T;
f2(T)=my_routine(f1);
Where my_routine is:
function g = my_routine(f)
syms T;
g(T)=1+f(T)
end
then everything works fine. Ie, the output is:
f2(T) =
T + 1
But if I try to make the output a function of something other than T, such doing:
syms x;
f1(x)=x;
f2(x)=my_routine(f1);
then f2(x) comes out as a function of T instead of x, ie, I get:
f2(x) =
T + 1