function [out1,out2,out3] = pend_ic(t,y,flag,w)

if nargin < 3 | isempty(flag),
   out1= [y(2); -w^2*sin(y(1)) ]; % The parameter w is passed as an
                                  % argument. 

else
   switch flag
      case 'init'                      % Return default [tspan,y0,options].
         out1=linspace(0,6*pi,200); % tspan
         out2=[0;1]; % Initial conditions given as a column vector.
         out3=[]; % Default options are used.
      otherwise
         error(['Unknown flag ''' flag '''.']);
   end
end
