pkg load signal;

t_off=2.52683923950417e-04;
t_on=3.05171993781422e-04;
freq=1e5;

t=[linspace(t_on+t_off,1e-3+t_on+t_off,1000+1)];


function v = square2 (t, duty = 0.5)
  
  t=t/2/pi;
  v = ones(size(t));
  v(t-floor(t) >= duty) = -1;
end

function v = square3 (t, duty = 50)
  
  t=t/2/pi;
  duty /=100;
  v = ones(size(t));
  v(t-floor(t) >= duty) = -1;
end

vv1=square((t - t_on-t_off)*freq*2*pi, 0.8);
vv2=square2((t - t_on-t_off)*freq*2*pi, 0.8);
vv3=square3((t - t_on-t_off)*freq*2*pi, 0.8);