Error in fminsearch (line 200) fv(:,1) = funfcn(x,varargin{:});
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I am new to MATLAB and I am trying to minimize a function using fminsearch (line 145, caviaropt.m). But when I do that an error pops "Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 3-by-1" . The function gives a 3x1 vector at initial points but the function has to return a scalar in order to apply fminsearch. How can I solve this issue?
Any help is much appreciated!
2 个评论
Matt J
2021-1-10
Why does your function give a 3x1 vector? If you are trying to minimize a value fval, then your function should return fval.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!