How is it possible to reduce the number of parameters in an anonymous function in MATLAB? Here is an short example:
f = @(p,x) p(1).*x.^2 + p(2);
p = [1,2];
g = @(x) f(p,x);
So long this works fine. But I would like to export the final function with all parameters to a string.
string = func2str(g);
The result is @(x) f(p,x) but in my mind it should be something like @(x) 1.*x.^2 + 2.
How is it possible to realize this?