%
%   fun2b.m  function to evaluate f = exp(at)*sin(wt)
%               (uses vectorized check)
%
%   t can be a vector, and f is the same size as t
%   T is the period of oscillation (input scalar)
%   'a' changes in a discrete fashion at t = 5 sec
%     a = -0.2 1/s for t <= 5 sec
%     a = -0.5 1/s for t > 5 sec
%
%   Prepared by J.R White, UMass-Lowell (last update: Sept. 2017)
%
      function f = fun2b(t,T)
      w = 2*pi/T;   tt = 5;
      f = zeros(size(t));
      a = -0.2; i = t <= tt;  f(i) = exp(a*t(i)).*sin(w*t(i));  %  for t <= 5
      a = -0.5; i = t > tt;   f(i) = exp(a*t(i)).*sin(w*t(i));  %  for t > 5
