%-----------------------------------
% script aliasing
clear
[z,Fs,bits]=wavread('tele_tones_1.wav');
a=input('starting point')
n=input('length of series (=power of 2)')
stride=input('stride (=power of 2) < length)')
x=z(a:stride:a+n); m=n/2/stride;
%-----------------------------------
y = fft(x(1:n/stride));
P2 = struct('a',real(y(1:m+1))/m,'b',-imag(y(2:m))/m);
P2.a(1)=P2.a(1)/2;P2.a(m+1)=P2.a(m+1)/2;
Bvals = linspace(0,n/Fs,n+1)';
Gvals = CSeval(P2,n/Fs,Bvals);
plot(Bvals(1:100*stride),Gvals(1:100*stride)-z(1:100*stride))
%axis([0 360 -.05 1.05])
%set(gca,'xTick',linspace(0,360,13))