clear
N=12;
i=1:N;
hs(i)=sin(2*pi*i/N);
hc(i)=cos(2*pi*i/N);
for p=1:((N/2)+1)*10;
for k=1:N+N/2;
for i=1:4;
a(i)=pi*(i-1)/6;
y(:,:,i)=sin(a(i)+(2*pi/N)*(k-1)*(p-1)/10);
end
s(:,k,:)=y;
end
w(p,:,:)=s;
end
for p=1:((N/2)+1)*10;
for i=1:4;
x1=w(p,i,:);
x2=x1(:);
ys=filter(hs,1,x2);
yc=filter(hc,1,x2);
ym=2*sqrt(ys.^2+yc.^2)/N;
s1(:,i)=ym(N+N/2);
end
w1(p,:)=s1;
end
y1=w1(:,1);y2=w1(:,2);
y3=w1(:,3);y4=w1(:,4);
[m,n]=size(y1);
k=0:0.1:(m-1)/10;
subplot(221);
plot(k,y1);axis([0,6,0,1.2]);legend('a=0*pi');grid
xlabel('f/f0');ylabel('h');
subplot(223);
plot(k,y2);axis([0,6,0,1.2]);legend('a=pi/6');grid
xlabel('f/f0');ylabel('h');
subplot(222);
plot(k,y3);axis([0,6,0,1.2]);legend('a=pi/3');grid
xlabel('f/f0');ylabel('h');
subplot(224);
plot(k,y4);axis([0,6,0,1.2]);legend('a=pi/2');grid
xlabel('f/f0');ylabel('h');