clear all;
close all;

fn = 50;
tn = 1/fn;
ts = tn/100;
p = 4;

a1 = 1;
a2 = 0.1;

phiGrad = 165;
phiRad = phiGrad * pi / 180;

t = 0:ts:(p*tn)-ts;

sinus = a1 * sin(2*pi*fn*t);
squareS = a2 * square(2*pi*fn*t - phiRad,50);

subplot(2,1,1);
plot(t,sinus,t,squareS);
grid on;
subplot(2,1,2);
plot(t,sinus+squareS);
grid on;