I'm using this code:
y1=symfun(c^2+p^2, [c,p]);
y2=matlabFunction(y1)
[x,fval]=fminsearch(y2, [0 0])
but it returns
Error using makeFhandle/@(c,p)c.^2+p.^2
Not enough input arguments.Error in fminsearch (line 191)
fv(:,1) = funfcn(x,varargin{:});
How can I get around this?
Note that I'm using symfun rather than a function-handle, because I'm adding several functions.