% Veletlenszam generator inicializalasa az adott pillanatra
rng(datenum(now));

%% 1. Szinuszos jel zajjal
N=128; k = 0:127; Th0 = 2*pi/32; Th1 = 2*pi/16; Th2 = 2*pi/64;
u1 = 2*sin(Th0*k) + (-0.2+0.4*rand(size(k)));
f = figure; plot(k,u1,'r-o','LineWidth',1,'MarkerFaceColor','k'); xlabel('k'); ylabel('u1');
print(f,'u1','-depsc');

%% 2. Háromszög jel zajjal
L = 32;
ut = -4 + (4/32)*[0:31];
u2 = [2+ut -2-ut 2+ut -2-ut];
u2z = u2 + (-0.5 + rand(size(k)));
f = figure; plot(k,u2z,'r-o','LineWidth',1,'MarkerFaceColor','k'); xlabel('k'); ylabel('u2z');
print(f,'u2','-depsc');

%% 3. Negyszog
u3 = -1+2*(stepfun(k,0) -stepfun(k,L)+stepfun(k,2*L)-stepfun(k,3*L));
u3z = u3 + (-0.5 + rand(size(k)));
f = figure; plot(k,u3z,'r-o','LineWidth',1,'MarkerFaceColor','k'); xlabel('k'); ylabel('u3z');
print(f,'u3','-depsc');

%% 4. Capafog 
u4 = [-1+(2/32)*[0:31] -1+(2/32)*[0:31] -1+(2/32)*[0:31] -1+(2/32)*[0:31]];
u4z = u4 + (-0.5 + rand(size(k)));
f = figure; plot(k,u4z,'r-o','LineWidth',1,'MarkerFaceColor','k'); xlabel('k'); ylabel('u4z');
print(f,'u4z','-depsc');

%% 5. Tobb szinusz 
u5 = sin(Th0*k) + sin(Th1*k+pi/4) + sin(Th2*k+pi/3) ;
u5z = sin(Th0*k) + sin(Th1*k+pi/4) + sin(Th2*k+pi/3) + (-0.25 + rand(size(k))*0.5);
f = figure; plot(k,u5z,'r-o','LineWidth',1,'MarkerFaceColor','k'); xlabel('k'); ylabel('u5z'); hold on; plot(k,u5,'k-o');
print(f,'u5','-depsc');

%% 6. Egyenes 
u6 = (1/N)*2*k;
u6z1 = u6 + (-0.1+0.2*rand(size(k)));
u6z2 = u6 + (-0.2+0.4*rand(size(k)));
u6z3 = u6 + (-0.3+0.6*rand(size(k)));
u6z4 = u6 + 0.1*sin(Th0*k);
f = figure; plot(k,u6z1,'r-o','LineWidth',1,'MarkerFaceColor','k'); xlabel('k'); ylabel('u5z'); hold on; plot(k,u6,'k-o');
print(f,'u6z1','-depsc');

f = figure; plot(k,u6z2,'r-o','LineWidth',1,'MarkerFaceColor','k'); xlabel('k'); ylabel('u5z'); hold on; plot(k,u6,'k-o');
print(f,'u6z2','-depsc');

f = figure; plot(k,u6z3,'r-o','LineWidth',1,'MarkerFaceColor','k'); xlabel('k'); ylabel('u5z'); hold on; plot(k,u6,'k-o');
print(f,'u6z3','-depsc');
f = figure; plot(k,u6z4,'r-o','LineWidth',1,'MarkerFaceColor','k'); xlabel('k'); ylabel('u5z'); hold on; plot(k,u6,'k-o');
print(f,'u6z4','-depsc');

