function [derx,tnext]=masaresev()
  
function dx = derx(x,t)
  t1 = 2.123;
  t2=5.678;
  k = 1;
  m = 1;
  b = 100;
  dx = x;
  dx(1) = x(2);
  if (t>t1)&(t<t2) then
    dx(2) = -k/m*x(1)-b/m*x(2)+1/m;
  else
    dx(2) = -k/m*x(1)-b/m*x(2);
  end
  
endfunction

function tn=tnext(x,t)
  t1 = 2.123;
  t2=5.678;
  if t<t1 then 
    tn=t1;
  elseif t<t2 then
    tn=t2;
  else
    tn=1e20;
  end
endfunction

endfunction     
