function [x]=Autocorrelation(a)
%function [x]=PitchDetection(a) is used to find the period of a singal
%input "a" is a given singal
%inpit "r" is the range of data of the given signal
%output "x" is the ACF (aotucorrelation function) of signal "a"
b=a;
m=1;
x=zeros(1,501);
for m=1:501
c=501;k=1;
for c=501:1001
x(m)=abs(a(c)-b(c-m+1))+x(m);
c=c+1;
end
x(m)=x(m)/501;
m=m+1;
end