% 
%  Aufruf: >> x_max = dgl( 1, 3, 1, 1 ) 
% 
function x_max = dgl( k, tm, x0, v0 ) 

   [t,y] = ode45( @dglFun, [0 tm], [x0 v0], [], k );
   
   x = y(:,1);
   v = y(:,2);
   
   x_max = max( x ); 
   
   subplot( 1,2,1 )
   plot( t,x )
   subplot( 1,2,2 )
   plot( t,v )

end 

function dy_dt = dglFun( t, y, k )
   dy_dt(1,1) = y(2);
   dy_dt(2,1) = -k*y(2);
end
