function [y] = square (t, freq, duty)
    tt = numel(t);
    y = zeros(1,tt);
    div = 1 / freq; % okres
    z = div * duty / 100; % dlugosc stanu wysokiego
    
    for i = 1:tt
        r = rem(t(i), div);
        if (r < z)
            y(i) = 1;
        end
    end
end
