Error using fmincon, Supplied objective function must return a scalar value.
显示 更早的评论
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;
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!