I am trying to use the fsolve function to solve a non linear equation .In the function i created all the constants are matrices.and i expect a vector of the unknown.I keep getting error of not enough input argument.Iwould much appreciate your help.
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
function F = TRIAL3(x, V1,W1 ,W, w, z, Z1,Z, p, p1, q1, q, c1, V, v, j)
a=x(1); r = x(2); s = x(3); b=x(4); g = x(5); d = x(6); h = x(7);
F = [(V1*((c1- W*r - Z*s)+(p*b- W*r*b^2 -Z*s*b.^2 - j*d*b) +(q*g- W*r*g^2- Z*s*g.^2 - j*h*g)))-1*a- a*b^2 - a*g.^2;
(W1*((c1- V*a - Z*s)+(p*b- V*a*b^2 -Z*s*b.^2 - j*d*b) +(q*g- V*a*g^2 - Z*s*g.^2 - j*h*g)))-1*r- r*b^2 - r*g.^2;
(Z1*((c1- V*a- W*r)+ (p*b- V*r*b^2 -W*r*b.^2 - j*d*b) +(q*g- V*a*g^2 - W*r*g.^2 - j*h*g)))-1*s- s*b^2 - s*g.^2;
(inv(a'*v*V*a + a'*v*W*r +a'*v*Z*s + r'*w*V*a + r'*w*W*r+ r'*w*Z*s + s'*z*V*a+ s'*z*W*r +s'*z*Z*s)*(p1*V*a+ p1*W*r + p1*Z*s -a'*v*j*d - r'*W'*j*d +s'*Z'*j*d))-b;
(inv(a'*v*V*a + a'*v*W*r +a'*v*Z*s + r'*w*V*a + r'*w*W*r+ r'*w*Z*s + s'*z*V*a+ s'*z*W*r +s'*z*Z*s)*(q1*V*a+ q1*W*r + q1*Z*s -a'*v*j*h - r'*W'*j*h +s'*Z'*j*h))-g;
(0.2*p1*j - 0.2*a'*v*j*b - 0.2*r'*w*j*b - 0.2*s'*z*j*b)- d;
(0.2*q1*j - 0.2*a'*v*j*b - 0.2*r'*w*j*g - 0.2*s'*z*j*g)- h];
%below is my call function;
fun=@TRIAL3; Xo=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]; X=fsolve(fun,Xo)
%my error message Error using TRIAL3 (line 5) Not enough input arguments.
Error in fsolve (line 217) fuser = feval(funfcn{3},x,varargin{:});
Caused by: Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
0 commentaires
Réponse acceptée
Torsten
le 12 Juin 2018
fun = @(x)TRIAL3(x, V1,W1 ,W, w, z, Z1,Z, p, p1, q1, q, c1, V, v, j);
Xo = [1 1 1 1 1 1 1];
X = fsolve(fun,Xo)
9 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surrogate Optimization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!