第8章 MATLAB数值微积分与最优化.pptVIP

  • 9
  • 0
  • 约7.1千字
  • 约 35页
  • 2018-05-02 发布于湖北
  • 举报
第8章 MATLAB数值微积分与最优化

例4 1.先建立M文件fun.m定义目标函数: function f=fun(x); f=-2*x(1)-x(2); 2.再建立M文件mycon2.m定义非线性约束: function [g,ceq]=mycon2(x) g=[x(1)^2+x(2)^2-25;x(1)^2-x(2)^2-7]; ceq=[];  3. 主程序fxx.m为: x0=[3;2.5]; VLB=[0 0];VUB=[5 10]; [x,fval,exitflag,output] =fmincon(fun,x0,[],[],[],[], VLB,VUB,mycon2) 4. 运算结果为: x = 4.0000 3.0000 fval =-11.0000 exitflag = 1 output = iterations: 4 funcCount: 17 stepsize: 1 algorithm: [1x44 char] firstorderopt: [] cgiterations: [] 更多函数, 参见optimization

文档评论(0)

1亿VIP精品文档

相关文档