You are on page 1of 1

MATLAB code for plotting radial patterns % Note: The Matlab function (polar) doesnt accept negative values

for ; so instead of plotting from -xx d to !" #e can plot from ! to $xx d as follo#s: d limit % &!; % 'et the range (for example ! to &! d ) ( % abs(())max(abs(()); (*d % &!+log,!(() $ d limit; for (i % ,:length((*d )) if ((*d (i) 0 !) (*d (i) % !; end end polar (theta" (*d ) % Ma-e sure that the argument for the % function polar ((*d ) is al#a.s /%!

MATLAB code for 3-D integration of patterns %1ssume #e need to calculate the 2irectivit. of a short dipole oriented along the 3-axis (( % sin()); %then #e #ill need to integrate the normali4ed 5-2 pattern over %theta and phi %2 % 6p)1; #here the beam solid angle 1 %

| En | 2 sin()dd

%7e can calculate the integration numericall. using dbl8uad: eam'olid1ngle%dbl8uad(9calc:"!"pi"!"&+pi); 2 % 6+pi)( eam'olid1ngle); 2db % ,!+log,!(2); %7here calc: is a function defines the integrand of dbl8uad: function : % calc:(theta"phi) ( % sin(theta); % Note that this should be normali4ed; other#ise .ou % #ill get #rong number for the 2irectivit. :% sin(theta);+abs(();<&;

You might also like