Difficulty in calling values from main program to fsolve function
显示 更早的评论
my version is MATLAB 7.10.0(R2010a) My main program is aa=10; ab=12; ac=18; x0=[0;0]; result=fsolve(@myfun3,x0);
My function is myfun3 created as function F=myfun3(x) F=[2*x(1)^2+(x(2)*aa)+ab;5*x(2)^2+x(1)+ac]; end
the error shown is ??? Undefined function or variable 'aa'.
Error in ==> myfun3 at 2 F=[2*x(1)^2+(x(2)*aa)+ab;5*x(2)^2+x(1)+ac];
Error in ==> fsolve at 254 fuser = feval(funfcn{3},x,varargin{:});
Error in ==> yyyy at 5 result=fsolve(@myfun3,x0);
Caused by: Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
As i have sorted out the problem the function is not recognising the value of aa,ab and ac from the main problem.Why is that?????
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Entering Commands 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!