function [t, y, w, amp, phase] = expfunc(time_on, freq_on, a, b, t0, c, T, W);

t = -4.00001:0.01:3.99999;	% prevent division by zero...
ImpResp=0.01*sin(W*t)./(pi*t);

if (time_on==0),
   if (freq_on==0),
      t = -4:0.01:4;  
      y = a/c*exp(-b/c*t+t0).*ustep(b/c*t-t0);

      w = -4:0.05:4;
      Y = a./(b+c*j*w).*exp(-(j*w*t0));
      phase = angle(Y);
      amp = abs(Y);

   else
      t = -4:0.01:4;  
      y = a/c*exp(-b/c*t+t0).*ustep(b/c*t-t0);
      yc=conv(y,ImpResp); 
      y=yc(400:1200);	

      w = -4:0.05:4;
      Y = [a./(b+c*j*w).*exp(-(j*w*t0))].*[ustep(w+W) - ustep(w-W)];
      phase = angle(Y);
      amp = abs(Y);
   end

else
   if (freq_on==0),
      t = -4:0.01:4;  
      y = a/c*exp(-b/c*t+t0).*ustep(b/c*t-t0).*[ustep(t+T) - ustep(t-T)];

      w = -4:0.05:4;
      Y = a./(b+c*j*w).*[exp(-j*w*t0) - (exp(t0-T).*exp(-(j*w*T)))];
      phase = angle(Y);
      amp = abs(Y);
   else
      t = -4:0.01:4;  
      y = a*exp(-b/c*t+t0).*ustep(b/c*t-t0);
      yc=conv(y,ImpResp);
      y=yc(400:1200);
     
      w = -4:0.05:4;
      Y = [a./(b+c*j*w).*exp(-(j*w*t0))].*[ustep(w+W) - ustep(w-W)];
      phase = angle(Y);
      amp = abs(Y);
   end
end
