Unable to run a simple 'fsolve' example.
18 次查看(过去 30 天)
显示 更早的评论
Hi,
While running the root2d example file provided with the 'fsolve' document, MATLAB is throwing the following error:
Unrecognized function or variable 'eml_allow_mx_inputs'.
Error in fsolve
The code for root2d file is below and the m-file is placed in the MATLAB directory:
function F = root2d(x)
F(1) = exp(-exp(-(x(1)+x(2)))) - x(2)*(1+x(1)^2);
F(2) = x(1)*cos(x(2)) + x(2)*sin(x(1)) - 0.5;
end
I am running the following syntax to solve 'root2d':
fun = @root2d;
x0 = [0,0];
x = fsolve(fun,x0)
2 个评论
Walter Roberson
2023-4-11
Experiment with
restoredefaultpath; rehash toolboxcache
If that solves the problem then
savepath
采纳的回答
Steven Lord
2023-4-11
My guess is that you accidentally added the toolbox/optim/eml directory under matlabroot to the MATLAB search path. If it is on the path, remove it from the path.
contains(path, "toolbox/optim/eml")
When you run the following command it should not list the fsolve.m file in toolbox/optim/eml. It should list the one in toolbox/optim/optim.
which -all fsolve
The version of the file in toolbox/optim/eml is only used by MATLAB Coder when you generate C or C++ code from a function that calls fsolve.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!