function [cm,ppo,c] = gridopt(fcn,x,io,x0,mode,outside,maxit,new)
% [cm,ppo,c] = gridopt(fcn,x,io,x0,mode,outside,maxit,new)
%
% fcn     :  string defining function.  All parameters of fcn 
%            must be called within the string fcn as x(1), x(2), x(3), ... 
%
% x       :  vector of parameters of fcn.  
%            Although the parameters within fcn are named x(i) the actual 
%            parameter set for this formal x may be an arbitrary named vector.
%            The value of x(io(1)) and x(io(2)) are arbitrary since they are 
%            variied for optimization.
%
% io      :  vector of two indices. The parameters x(io(1)) and x(io(2)) 
%            are variied to find the desired optimum
%
% x0      :  3*2-matrix defining the rectangular optimization plane
% x0(1,:) :  parameters [x(io(1)) x(io(2))] at edge 1
% x0(2,:) :  parameters [x(io(1)) x(io(2))] at edge 3
% x0(3,:) :  parameter step
%
% mode    :  mode = 0 (default) :  search for minimum
%            otherwise search for maximum 
%
% outside :  string with boolean MATLAB-expression that specifies 
%            regions within the x(io(1)),x(io(2))-plane not to be considered
%
% maxit   :  number of refinement iterations (default: 2)
%
% new     :  new ~= 0 :  Start of a new computation
%            new = 0  :  A non-finished computation will be resumed (default)
