e693.m

来自「matlab算法集 matlab算法集」· M 代码 · 共 32 行

M
32
字号
%------------------------------------------------------------------------
% Example 6.9.3: Maximum Power Extraction 
%------------------------------------------------------------------------

% Initialize

   clc                   % clear screen
   clear                 % clear variables             
   global R              % used by funf693.m
   a = 0;                % lower limit
   b = 10;               % upper limit 
   x0  = 2;              % initial guess
   tol = 1.e-4;          % error tolerance
   m   = 500;            % maximum number of iterations    

% Find optimal load resistance 

   fprintf ('Example 6.9.3: Maximum Power Extraction\n');
   [x,ev,k] = dfp (x0,tol,1,m,'funf693');
   show ('Load Resistance R (ohm)',x);

% Compute power dissipated 

   [i,k] = bisect (0,2*x,tol,m,'funp693');
   show ('Current I (A)',i)
   show ('Power Delivered P (watt)',-funf693(x))

% Plot objective function

   graphfun (a,b,'Objective Function','x','f(x)','funf693')
%------------------------------------------------------------------------

⌨️ 快捷键说明

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