% Project 2 # 5: electronically-steered one-dimentional loudspeaker array % sweeping L=1; theta=-pi/2:pi/180:pi; c=345; %cs=489; %this is the speed of the wavelength for the theta=45 degrees %theta=asin(c/cs) %pi/4=asin(345/cs) for f=10000 for degree=-45:10:135 rad=(degree*2*pi/360); cs=c/sin(degree); k=2*pi*f/c; lambda=c/f; lambda_s=cs/f; u=(L/lambda).*sin(theta); G=sin(pi*(u-L/lambda_s))./(pi*(u-L/lambda_s)); %sinc function G=abs(G); figure(1); polar(theta,G,'m-') %Plot title(['Beam Pattern, L = ',num2str(L),'m',', cs = ',num2str(cs),'m/s, f = ',num2str(f),'Hz']) pause(1) end end