Below is the code for planer Array factor of 10x10. I am facing diffcuilty in ploting polar and surface graph in dB scale. Formula file of array factor is also attached in PNG format. Please help
clear all;
clc;
c=3e8;
f=2.5e9; %f=2.5Ghz
lambda=c/f;
k = 2*pi/lambda; % wave number
theta0 = (0:1:360)*pi/180; %azimuth
phi0 = (-180:1:180)*pi/180; %elevation
[phi,theta]=meshgrid(phi0,theta0);
N = 10;%input('Enter the number of elements in X-axis = ')
M = 10;%input('Enter the number of elements in Y-axis = ')
dx = lambda/2; %input('Inter-Element sapcing in X-axis (in mm) = ')
dy = lambda/2; %input('Inter-Element sapcing in Y-axis (in mm) = ')
phase_x= 0;
phase_y= 0;
Shi_x = k*(dx).*sin(theta).*cos(phi) + phase_x;
Shi_y = k*(dy).*sin(theta).*sin(phi) + phase_y;
f_x = (1/N).*(sin(N*Shi_x./2))./(sin(Shi_x./2)); %normalized array factor for the distribution in x direction
f_y = (1/M).*(sin(M*Shi_y./2))./(sin(Shi_y./2)); %normalized array factor for the distribution in y direction
AF = (f_x).*(f_y);
%dBAF= 20*log10(abs(AF));
polarplot(theta, abs(AF));
%surf(phi*180/pi,theta*180/pi, abs(dBAF));
%axis([0 360 0 180 -40 40])
shading interp