Difficulty in calling values from main program to fsolve function
Afficher commentaires plus anciens
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?????
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Entering Commands dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!