⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e661.m

📁 matlab算法集 matlab算法集
💻 M
字号:
%------------------------------------------------------------------
% Example 6.6.1: Davidon-Fletcher-Powell Method 
%------------------------------------------------------------------
   clc
   clear
   global a b q r
   a = 3;		% coordinates of minimum
   b = 3;
   q = 8;		% orders of objective terms
   r = 4;
   n = 2;
   m = 1000;
   p = 100;
   v = n;
   tol = 2.e-7;
   d = 6;
   x  = zeros (n,1);
   x1 = zeros (p,1);
   x2 = zeros (p,1);
   Y  = zeros (p,p); 

% Find a minimum 

   fprintf ('Example 6.6.1: Davidon-Fletcher-Powell Method\n');
   [x,ev,j] = dfp (x,tol,v,m,'funf661');
   fprintf ('\nIterations = %g',j);
   fprintf ('\nFunction evaluations = %g',ev);
   fprintf ('\nOptimal x    = [%.7f,%.7f]',x);
   fprintf ('\nf(x)         = %.7f\n',funf661(x)); 
   
% Plot the objective function 

   for i = 1 : p
      x1(i) = (i-1)*d/(p-1);
      x2(i) = (i-1)*d/(p-1);
   end
   for i = 1 : p
      for j = 1 : p
      	 x(1) = x1(i);
      	 x(2) = x2(j);
         Y(i,j) = funf661(x);
      end
   end
   plotxyz (x1,x2,Y,'','x_1','x_2','f(x)');


   


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -