How to draw the log polar diagram and linear cartesian diagram of this code?

2 views (last 30 days)
Here is the code. It is currently a linear polar diagram. How to draw a log polar diagram (dB=20loglinear) and a linear cartesian diagram about this ?
clear all;
% element numbers
N = 8;
% element spacing
wl = 1;
k = 2.*pi./wl;
d = wl./2;
% theta zero direction
% 90 degree for braodside, 0 degree for endfire.
%theta_zero = 90;
An = 1;
j = sqrt(-1);
AF = zeros(1,180);
for theta=1:180
% change degree to radian
deg2rad(theta) = (theta*pi)/180;
%array factor calculation
for n=1:N
AF(theta) = AF(theta) + exp((-1j).*k.*(n-1).*d.*sin (deg2rad(theta))) ;
end
AF(theta) = abs(AF(theta));
end
  8 Comments
Alan Stevens
Alan Stevens on 18 Jan 2021
"plot(rad2deg(deg2rad),AF)
which is a nightmare for anyone reading your code."
I agree!! I wrote that after I had gone through the original program and used theta in radians from the start!

Sign in to comment.

Answers (0)

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!