function [tax,mrate] = comptax(taxinc,taxsched)
%COMPTAX    Computes taxes paid and the marginal rate given
%              (1) taxable income 
%              (2) the tax schedule
%  
%
[m,n] = size(taxsched);
if (n~=3);
  disp('Expected tax schedule to have 3 columns')
end;

tax    = 0;
mrate  = 0;
for i=1:m;
  if (taxinc>=taxsched(i,1));
    tax    = taxsched(i,2)+taxsched(i,3)*taxinc;
    mrate  = taxsched(i,3);
  end
end

