Radiation pattern plotting.
107 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Yuval
am 28 Nov. 2016
Beantwortet: Akash Pawar
am 16 Jan. 2023
Hi, I am having difficulties plotting the following function:
theta = -2:0.01:2;
y = (cos(pi/4*cos(theta*pi))-cos(pi/4))./(sin(theta*pi)*sin(pi/4));
I'd like it to resemble as closely as possible the plot in the attachment.
I'd certainly appreciate any assistance. I understand that patterncustom() is probably to be used, yet I am not quite sure how. NB The pi/4 argument in the expression for y is the result of substituting l=lambda/4 in the original.
2 Kommentare
Hildo
am 28 Nov. 2016
Bearbeitet: Walter Roberson
am 29 Nov. 2016
Appear that is a cylindrical coordinates plot ( y as function(theta,r) ). But you are just seeing a slice on the y-axis.
Akzeptierte Antwort
Omkar Savkur
am 29 Jun. 2021
Hi Yuval, building off David's answer, you can use the polarpattern function to help plot the radiation power. You can interact with the plot and specify the plot parameters all in one line.
% Angle in degrees
theta = (-1:.001:1)*180;
% lambda is arbitrary in this calculation; pick a value
lambda = 1;
% d is entire dipole length, both halves
d = lambda/4;
k = 2*pi/lambda;
kd2 = k*d/2;
y = 20*log10(abs((cos(kd2.*cosd(theta))-cos(kd2))./sind(theta)));
y = y-max(y);
% normalize y to obtain directivity; new max is 0 dB
y(y<-40) = -40;
figure(1)
polarpattern(theta,y,'AngleDirection','cw','AngleAtTop',0,'AngleResolution',30)
2 Kommentare
Gerard Marcial Sopsop
am 5 Jul. 2021
Hello, may I ask what "k" and "kd2" in the code stands for in the formula of radiation pattern? Thanks.
Chirag
am 11 Jan. 2023
Weitere Antworten (5)
David Goodmanson
am 20 Nov. 2017
Hi Yuval,
I made a stylistic change to your code and defined theta at the very start with the factor of pi, rather than waiting to do that in the trig functions. Also the code below has the necessary range of -pi to pi and no more, rather than the duplicate overplotting that happens with -2pi to 2pi.
Since the formula you are using is the linear quantity E rather than intensity ~~E^2, the conversion to dB is 20*log(....) rather than 10*log(....).
theta = (-1:.001:1)*pi;
lambda = 1; % lambda is arbitrary in this calculation; pick a value
d = lambda/4; % d is entire dipole length, both halves
k = 2*pi/lambda;
kd2 = k*d/2;
y = 20*log10(abs((cos(kd2.*cos(theta))-cos(kd2))./sin(theta)));
y = y-max(y); % normalize y to obtain directivity; new max is 0 dB
y(y<-40) = -40;
figure(1)
polarplot(theta,y)
rlim([-40 0])
set(gca,'thetazerolocation','top','thetadir','clockwise')
The entire figure from the book can be obtained by concatenating the y's for for other values of d into a 5x2001 matrix and plotting, or the y's can be plotted sequentially using the 'hold on' command.
The figure is a classic one but must have been done by hand, because if you look at the trace for d = 3*lambda/4, it comes close to passing through the point theta = 150, r = 10 but misses the corresponding one theta = 30, r = 10 by a lot more. Those two spots should be symmetric. The pc of course does a lot better in that regard, but lacks the same aesthetic.
0 Kommentare
Tamir Suliman
am 29 Nov. 2016
Hello please check my code at
2 Kommentare
Tamir Suliman
am 4 Dez. 2016
Bearbeitet: Tamir Suliman
am 4 Dez. 2016
Sir if you look at the answer you could use polar to plot the function
polar(theta,y)
you could use view([90 -90])
to rotate it accordingly the script that I sent has a similar function and similar plots
this is the result of plotting your function
Dan Klemfuss
am 18 Nov. 2017
Good Evening. Can you please check you equation? I've plotted several antenna gain patterns before but the resulting plot doesn't quite match the expected output. You should be able to generate the plot using the following if you obtain the right equation:
theta = -pi:0.01:pi;
y = (cos(pi/4*cos(theta*pi))-cos(pi/4))./(sin(theta*pi)*sin(pi/4));
figure('Name','3-dB beamwidth=87°','NumberTitle','off','MenuBar','none');
polarplot(theta, y,'k')
rlim([min(y)-5 max(y)+5]);
ax = gca;
ax.ThetaDir = 'clockwise';
ax.ThetaZeroLocation = 'top';
plotTitle = sprintf('Radiation Pattern');
title(plotTitle)
0 Kommentare
Yuvan Sankar
am 4 Mär. 2022
theta = (-1:.001:1)*pi; lambda = 1; % lambda is arbitrary in this calculation; pick a value d = lambda/4; % d is entire dipole length, both halves k = 2*pi/lambda; kd2 = k*d/2; y = 20*log10(abs((cos(kd2.*cos(theta))-cos(kd2))./sin(theta))); y = y-max(y); % normalize y to obtain directivity; new max is 0 dB y(y<-40) = -40; figure(1) polarplot(theta,y) rlim([-40 0]) set(gca,'thetazerolocation','top','thetadir
0 Kommentare
Akash Pawar
am 16 Jan. 2023
% Angle in degrees
theta = (-1:.001:1)*180;
% lambda is arbitrary in this calculation; pick a value
lambda = 1;
% d is entire dipole length, both halves
d = lambda/4;
k = 2*pi/lambda;
kd2 = k*d/2;
y = 20*log10(abs((cos(kd2.*cosd(theta))-cos(kd2))./sind(theta)));
y = y-max(y);
% normalize y to obtain directivity; new max is 0 dB
y(y<-40) = -40;
figure(1)
polarpattern(theta,y,'AngleDirection','cw','AngleAtTop',0,'AngleResolution',30)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Import, Export, and Visualization finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!