function [sol,stats] = odetest(problem,solver,atol,rtol,plotsel,opts)  
% Solve a problem in the testset format using the MATLAB ODE solvers  
%   
% [sol,stats] = odetest(problem,solver,atol,rtol,plotsel,opts) 
%   
% INPUT  
% problem = string with the name of the IVP TEST SET problem  
% ODE problems  
%     Hires, Pollu, Ringmod, Medakzo, Emep, Plei, vdpol,  
%     Rober, Orego, E5  
% DAE problems  
%     Chemakzo, Andrews, Transamp, Pump, Tba, Caraxis  
%     Fekete, Crank, Water  
% IDE problems  
%     Nand, Wheel  
%     
% solver = string with the calling name of the MATLAB solver  
% atol = absolute tolerance  
% rtol = relative tolerance  
% plotsel = index of component to be plotted (optional)   
% opts = solver parameters set with ODESET (optional)   
%     
% OUTPUT  
% sol.x  : mesh point of the approximate solution  
% sol.y  : solution computed at sol.x  
% sol.solver : solver used  
% sol.scd : significant digit of the approximate solution  
% sol.mescd : mixed significant digit of the approximate solution  
% sol.ierr  : error flag (0 = successfull run, 1 = error) 
%  
% stats.nsteps : number of successfull steps  
% stats.nfailed : number of failed steps  
% stats.nfevals : number of function evaluation  
% stats.npds : number of partial derivative  
% stats.ndecomps : number of LU decomposition  
% stats.nsolves : number of solution of linear systems  
%   
%---------------------------------------------------------------------  
%     This file is part of the Test Set for IVP solvers  
%     http://www.dm.uniba.it/~testset/  
%  
%  
%     DISCLAIMER: see  
%     http://www.dm.uniba.it/~testset/disclaimer.php  
%  
%     The most recent version of this source file can be found at  
%     http://www.dm.uniba.it/~testset/matlab/odetest.m  
%  
%     This is revision:  
%     $Id: odetest.m,v 1.2 2008/02/08 11:09:29 testset Exp $ 
%-----------------------------------------------------------------------  
 
  if nargin < 4  
    error('Not enough input arguments')      
  end    
  if nargin < 5 
    plotsel = []; 
  end 
  if nargin < 6 
    opts = []; 
  end 
   
  mlver = local_MLversion; 
   
  if mlver < 6.5 
    [sol,stats] = odetest_61(problem,solver,atol,rtol,plotsel,opts); 
  elseif mlver < 7.0 
    [sol,stats] = odetest_65(problem,solver,atol,rtol,plotsel,opts);   
  else % ML7.0 or above 
    if strcmpi(solver,'ode15i') 
      [sol,stats] = idetest_70(problem,atol,rtol,plotsel,opts);   
    else  
      [sol,stats] = odetest_70(problem,solver,atol,rtol,plotsel,opts);     
    end 
  end   
     
% ==========================================================================  
% Sub-function 
%   
 
function mlver = local_MLversion 
  v = version; % e.g., 7.4.0.34231 (R2007a)' 
  idx = strfind(v,'.'); 
  mlver = str2num(v(1:idx(2)-1)); % e.g., 7.4  
% end local_MLversion 
 
% --------------------------------------------------------------------------      
   
%EOF [odetest.m]  
 
