I want to plot the radiation pattern of a half wavelength dipole antenna using MATLAB. But in dB scale, the plot has undesired peaks.
The code is shown below:
theta = linspace(0,2*pi,1e3); wg =1; k = 2*pi/wg; l = wg/2; U = ((cos(k*l/2*cos(theta))-cos(k*l/2))./(sin(theta))).^2; Umax = max(U); Un = U/Umax; dbUn = 10*log(abs(Un)); polar(theta,dbUn) grid minor
The plot is shown below:
Actually this is a pretty simple algorithm to implement but I do not know what I did wrong.