f0=[24 5 21 1];
f1=circshift(f0,[0 1]);
f2=circshift(f0,[0 2]);
f3=circshift(f0,[0 3]);
fm1=circshift(f0,[0 -1]);
fm2=circshift(f0,[0 -2]);
fm3=circshift(f0,[0 -3]);
corr(1)=f0*fm3'/(f0*f0');
corr(2)=f0*fm2'/(f0*f0');
corr(3)=f0*fm1'/(f0*f0');
corr(4)=f0*f0'/(f0*f0');
corr(5)=f0*f1'/(f0*f0');
corr(6)=f0*f2'/(f0*f0');
stem(corr);
axis([0 7 0 2]);