% barridoelectronico
clear
N=40;d=.42;K=100;M=N/2;c=.3;
f=0:.01:pi;p=2*pi*d*cos(f);
for i=1:K+1
a=2*(i-1)*pi/K-pi;
g=abs(sin(N*(a+p)/2)./sin((a+p)/2)/N);
g1=abs(sin(M*(a+pi*c+p)/2)./sin((a+pi*c+p)/2)/N);
g2=abs(sin(M*(a-pi*c+p)/2)./sin((a-pi*c+p)/2)/N);
polar(f,g,'k'),hold,polar(f,g1,'r'),polar(f,g2),hold,pause(0);
end
for i=1:K+1
a=-2*(i-1)*pi/K-pi;
g=abs(sin(N*(a+p)/2)./sin((a+p)/2)/N);
g1=abs(sin(M*(a+pi*c+p)/2)./sin((a+pi*c+p)/2)/N);
g2=abs(sin(M*(a-pi*c+p)/2)./sin((a-pi*c+p)/2)/N);
polar(f,g,'k'),hold,polar(f,g1,'r'),polar(f,g2),hold,pause(0);
end