When I run the following code, there is no problem:
syms xDot(t) t alphadF_dxDot = @(t) -exp(-t)*alpha*xDot(t)^(alpha-1);Euler = matlabFunction(simplify(diff(dF_dxDot(t),t)),'vars',[t,alpha]);
But when I run the same code within a function.
function nothingsyms xDot(t) t alphadF_dxDot = @(t) -exp(-t)*alpha*xDot(t)^(alpha-1);Euler = matlabFunction(simplify(diff(dF_dxDot(t),t)),'vars',[t,alpha]);
it throws an error,
Error using alphaToo many output arguments.
since
which alpha
returns
/usr/local/MATLAB/R2016a/toolbox/matlab/graph3d/alpha.m
what appears to be happening is that my sym command takes precedence over matlab's command, provided I run the code within a regular script, but the precedence is reversed when I run it within a function. Surely this has to be a bug???
Best Answer