Radiation pattern plotting.

205 ビュー (過去 30 日間)
Yuval
Yuval 2016 年 11 月 28 日
回答済み: Akash Pawar 2023 年 1 月 16 日
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 件のコメント
Hildo
Hildo 2016 年 11 月 28 日
編集済み: Walter Roberson 2016 年 11 月 29 日
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 2016 年 11 月 28 日
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.

サインインしてコメントする。

採用された回答

Omkar Savkur
Omkar Savkur 2021 年 6 月 29 日
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 件のコメント
Gerard Marcial Sopsop
Gerard Marcial Sopsop 2021 年 7 月 5 日
Hello, may I ask what "k" and "kd2" in the code stands for in the formula of radiation pattern? Thanks.
Chirag
Chirag 2023 年 1 月 11 日
Hello @Omkar Savkur, Thanks for the answer. It helped me too, much appriciate.

サインインしてコメントする。

その他の回答 (5 件)

David Goodmanson
David Goodmanson 2017 年 11 月 20 日
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 2016 年 11 月 29 日
  2 件のコメント
Yuval
Yuval 2016 年 11 月 29 日
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 2016 年 12 月 4 日
編集済み: Tamir Suliman 2016 年 12 月 4 日
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
Dan Klemfuss 2017 年 11 月 18 日
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 2022 年 3 月 4 日

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 2023 年 1 月 16 日
% 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)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by