[img=92,61]file:///C:/Users/Administrator/AppData/Roaming/Tencent/Users/77086090/QQ/WinTemp/RichOle/F$BF8A0UVJQ%25WK@J5R4ER7N.png[/img]
function f=fun1(x);
f=0.3*x(1)*x(2)+0.7*(x(1)^2+x(2)^2);
function [g]=mycon(x)
g=[1-x(1)^2*x(2);x(2)-x(1);x(1)-4x(2)];
function youh3
clc;
x0=[-1,1];
A=[1];b=[2.5];
Aeq=[];beq=[];
vlb=[0,0];vub=[];
[x,fval]=fmincon(@fun1,x0,A,b,Aeq,beq,vlb,vub,@mycon)
输出结果总是错误,这是为什么?
>> fun1
??? Input argument "x" is undefined.
Error in ==> fun1 at 3
f=0.3*x(1)*x(2)+0.7*(x(1)^2+x(2)^2);
>>
作者: hachikoi 时间: 2016-8-5 18:34
[img]%5Bimg=92,61%5Dfile:///C:/Users/Administrator/AppData/Roaming/Tencent/Users/77086090/QQ/WinTemp/RichOle/F$BF8A0UVJQ%25WK@J5R4ER7N.png[/img][/img]
作者: hachikoi 时间: 2016-8-5 18:35
题目在pdf上,不好弄下来
欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) |
Powered by Discuz! X2.5 |