Failure in initial user-supplied objective function evaluation
Afficher commentaires plus anciens
I am trying to find the roots of a system of two equations with two variables and want to find the solution for different values of one of the parameters that is 'Dr'. As a start I created an .m file for the functions as
function F = root(x)
%parameters
global mh mv dha dhc qa pa qc pc bvh bhav bhcv na zeta sh sv Dr
%equations
F = [(x(2)*x(1)+mh*qa*pa-(mh+dha+na+zeta))*(X(2)*x(1)-(mh+dhc))*(Dr*((x(1)).^2)+x(2)*x(1)-mv)-mh*qc*pc*zeta*(Dr*((x(1)).^2)+x(2)*x(1)-mv)+bvh*(sv/sh)*(bhcv*zeta-bhav*(x(2)*x(1)-(mh+dhc)));
x(2).*(x(2).*x(1)-1.2).*(0.2*(x(1).^2)+x(2).*x(1)-1.2)+(x(2).*x(1)-1.993).*x(2).*(0.2*(x(1).^2)+x(2).*x(1)-1.2)+(x(2).*x(1)-1.993).*(x(2).*x(1)-1.2).*(.4*x(1)+x(2))-0.00336*x(1)-1.251691869*x(2)];
end
Then I recalled it in a separate file with this codes
clear
close all
global mh mv dha dhc qa pa qc pc bvh bhav bhcv na zeta sh sv Dr;
%parameters
mh=.7; mv=1.2; dha=0.2; dhc=0.5;
qa=0.1; pa=0.1;
qc=0.3; pc=0.1; na=0.7; zeta=.4;
bvh= 3; bhav=.2; bhcv=2.6 sh=426.87;
sv=884.57;
Dr=0.2;
x0 = [-10 -10];
[x,fval] = fsolve(@root,x0);
I don't know what is the problem! I tried different initial values for x0 but keep getting the same error.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur General Applications dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!