Radiation pattern plotting.

조회 수: 207 (최근 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 CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by