Documentation of plotdopi

Global Index (all files) (short | long) | Local contents | Local Index (files in subdir) (short | long)

Function Synopsis

x = plotdopi(OBJ_F, chrom, gen, P1, P2, P3);

Help text

 PLOTing of DO(Ppel)uble Integration results 

 This function plots some of the results during computation
 of the double integrator.

 Syntax:  plotdopi(OBJ_F, chrom, gen, P1, P2, P3)

 Input parameters:
    OBJ_F     - Vector containing the (name of the) objective function
    chrom     - Vector containing the individual for simulation
    gen       - Scalar containing the number of the current generation
    P1-P3     - additional parameters, see objdopi

 Output parameter:
    x         - Matrix containing the states from answer of objdopi

 See also: objdopi, simdopiv, simdopi1

Cross-Reference Information

This function calls This function is called by

Listing of function plotdopi



%  Author:    Hartmut Pohlheim
%  History:   09.06.95     file created
%             29.04.96     definition of genevalstr changed, made problem with error


function x = plotdopi(OBJ_F, chrom, gen, P1, P2, P3);

% Build string of objective function
   genevalstr = ['[objval, t, x] = ' OBJ_F, '(x'];
   if ~any(OBJ_F < 48)
      for i = 1:nargin-3
         genevalstr = [genevalstr, ',P', int2str(i)];
      end
      genevalstr = [genevalstr, ');'];
   end

% Compute states of individual x
   x = chrom(1,:);
   eval(genevalstr);

% look for figure, set Name
   FigUserName = 'geatbxfigstateplot_plotdopi';
   figplotdopi = findobj('UserData', FigUserName);
   if isempty(figplotdopi),
      figplotdopi = figure('UserData', FigUserName, 'NumberTitle', 'Off');
   end
   set(figplotdopi,'Name', ...
       sprintf('Simulation results of %s in gen %g', OBJ_F(1:min(8, size(OBJ_F, 2))), gen));
   set(figplotdopi, 'defaultaxesfontsize', 8)
   figure(figplotdopi);
   set(figplotdopi, 'PaperPosition', [0.5 2.5 6 6]);
   plotstd(figplotdopi); delete(get(figplotdopi, 'Children'));

% Get size of individual and states
   [Nind, Nvar] = size(chrom);
   [Nstep, Nstate] = size(x);

% plot of speed (state 1)
   subplot(2,2,1), plot(t, x(:,[1]), '-');
   title('Speed (state 1)');
   xlabel('time'), ylabel('speed');

% plot of position (state 2)
   subplot(2,2,2), plot(t, x(:,[2]), '-');
   title(['Position (state 2)']);
   xlabel('time'), ylabel('position');

% plot of speed and position
   subplot(2,2,3), plot(t, x(:,[1]), '-', t, x(:,[2]), '-.');
   title(['Speed (-) and Position (-.)']);
   xlabel('time'), ylabel('speed/position');

% plot of control
   subplot(2,2,4);
   plot(chrom);
   title(sprintf('Control, ObjV: %.5g', objval));
   xlabel('step'), ylabel('control');

   drawnow;


% End of function
GEATbx: Main page  Tutorial  Algorithms  M-functions  Parameter/Options  Example functions  www.geatbx.com 

This document is part of version 3.7 of the GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with Matlab - www.geatbx.com.
The Genetic and Evolutionary Algorithm Toolbox is not public domain.
© 1994-2005 Hartmut Pohlheim, All Rights Reserved, (support@geatbx.com).