Radiation pattern plotting.

107 Ansichten (letzte 30 Tage)
Yuval
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
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.
Yuval
Yuval am 28 Nov. 2016
The graph's actually supposed to be a function of theta alone. It's intended to represent the radiation pattern from a dipole for several wave lengths. I realise patterncustom() is most likely the function which would yield the desired result, yet couldn't quite understand from MATLAB's library how to use it.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Omkar Savkur
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)
You can also use other Antenna Toolbox functions, like pattern, which plots far-field radiation patterns. EHfields can be used to plot electric and magnetic fields at any observation locations, both near and far-field components.
  2 Kommentare
Gerard Marcial Sopsop
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
Chirag am 11 Jan. 2023
Hello @Omkar Savkur, Thanks for the answer. It helped me too, much appriciate.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (5)

David Goodmanson
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.

Tamir Suliman
Tamir Suliman am 29 Nov. 2016
  2 Kommentare
Yuval
Yuval am 29 Nov. 2016
Hi, Thanks, but it's not what I actually wanted. I think patterncustom() could get me there yet I'm simply not sure how to use it. Could you please help me with calling patterncustom() instead?
Tamir Suliman
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

Melden Sie sich an, um zu kommentieren.


Dan Klemfuss
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)

Yuvan  Sankar
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


Akash Pawar
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)

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!

Translated by