t=[0:1/100:10];
A = 1;
f=20
T=1/f

S= zeros(1,length(t))

s=A*sin((2*pi/T)*t);
[c, tau]=xcorr(s, 30, 'unbiased')
%plot(tau, c);
Pth = A^2/2;
bruit=randn(size(t));
bruit=(bruit-mean(bruit))/std(bruit);
bruit= bruit*sqrt(14*Pth);
%plot(bruit);
[cb, taub] = xcorr(bruit, 30, 'unbiased')
%plot(taub, cb)

superposition=[s+bruit];
[cs, taus]=xcorr(superposition, 30, 'unbiased')
plot(taus, cs, taub, cb);