Radiation pattern plotting.
102 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Yuval
el 28 de Nov. de 2016
Respondida: Akash Pawar
el 16 de En. de 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 comentarios
Hildo
el 28 de Nov. de 2016
Editada: Walter Roberson
el 29 de Nov. de 2016
Appear that is a cylindrical coordinates plot ( y as function(theta,r) ). But you are just seeing a slice on the y-axis.
Respuesta aceptada
Omkar Savkur
el 29 de Jun. de 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 comentarios
Gerard Marcial Sopsop
el 5 de Jul. de 2021
Hello, may I ask what "k" and "kd2" in the code stands for in the formula of radiation pattern? Thanks.
Chirag
el 11 de En. de 2023
Más respuestas (5)
David Goodmanson
el 20 de Nov. de 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 comentarios
Tamir Suliman
el 29 de Nov. de 2016
Hello please check my code at
2 comentarios
Tamir Suliman
el 4 de Dic. de 2016
Editada: Tamir Suliman
el 4 de Dic. de 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
el 18 de Nov. de 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 comentarios
Yuvan Sankar
el 4 de Mzo. de 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 comentarios
Akash Pawar
el 16 de En. de 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 comentarios
Ver también
Categorías
Más información sobre Import, Export, and Visualization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!