Error using fmincon, Supplied objective function must return a scalar value.
Afficher commentaires plus anciens
I have written following matlab code using fmincon function
Please some one help me to solve the following error that I am obtaining while running the code.
Xr=0:0.1:250;
X=load('meta22.txt');
t=X(:,1);
sw=X(:,2);
sws=X(:,3);
hd=X(:,4);
Yr=X(:,6);
Yp = 3.5/2*(1+tanh((3/30*(Xr+15-70))-1.2))-3.5/2*(1+tanh((3/30*(Xr+15-125))-1.5));
Jd = @(x) trapz(t,(sw+x(2).*sws-x(1).*(Yp-Yr-15.*x(3).*hd)).^2);
lb = [0.5;0.03;0.6];
ub = [1.2;0.3;1.2];
x0 = [0.6;0.1;0.8];
[x1,fval1] = fmincon(Jd,x0,[],[],[],[],lb,ub);
Gh_f=x1(1);
Td_f=x1(2);
Tp_f=x1(3);
Jdm = fval1;
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Numerical Integration and Differentiation 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!