function [f] = square_wave_func(t, T)
% Function to evaluate a square wave of period T
  if (t <= T/2)
        f = 1;
    else
        f = -1;
    end
end