disp(' piston_radiation_pattern.m  ver 1.0  December 1, 2009');
disp(' by Tom Irvine  Email: tomirvine@aol.com  ');
disp(' ');
disp(' Far field radiation rattern of a         '); 
disp(' circular piston in an infinite baffle.   ');
disp(' ');
%
clear theta;
clear a;
clear f;
clear c;
clear lambda;
clear rad;
%
a=input(' Enter the radius of the piston (cm) ');
a=a/100;
f=input(' Enter frequency (Hz) ');
c=input(' Enter the speed of sound (m/sec) '); 
lambda=c/f; 
k=2*pi/lambda; 
%
ka=k*a;
out1=sprintf('\n lambda = %8.4g m \n k=%8.4g (1/m) \n ka=%8.4g ',lambda,k,ka);
disp(out1);
%
theta=linspace(-pi/2,pi/2,300);
rad=abs(besselj(1,ka*theta)./(ka*theta));
%
polar(theta,rad/max(rad));
zoom on;