Simulating a hertzian dipole

9 visualizaciones (últimos 30 días)
basem ehab
basem ehab el 24 de Jul. de 2017
Comentada: SHYAM el 29 de Mzo. de 2024
Hi everyone, I am trying to create a code that simulates the electric field in the radial direction of a Hertzian Dipole Antenna. No matter what I try to change I was never able to produce the right figure. Here's my code:
clear
clc
epsilon= 8.85e-12;
f = 3e9;%frequency
c = 3e8;%speed of light
w = 2*pi*f;%omega
lambda = c/f;%wavelength
B = 2*pi/lambda; %beta
dl = lambda/30;
dt=1/f/90;
I0 = 1;%current
[x,z]=meshgrid(-lambda:dl:lambda,-lambda:dl:lambda);
r = (x.^2+z.^2).^(1/2);
theta = atan(x./z);
n = B/(w*epsilon);
E1 = n*I0*dl/(2*pi);
E2 = cos(theta);
E3 = r.^(-2)-r.^(-3)*1i/B;
E4 = exp(-1i*B*r);
E =E1*E2.*E3.*E4;%r component of the field
n= 1000;
M = moviein(n);%creating the movie
for i=1:n
t=i*dt;
Et=real(E*exp(1i*w*t));%converting to time domain
contour(Et)
M(i) = getframe;
end
movie(M)%plotting the movie
Any ideas?
Thanks in advance!

Respuesta aceptada

Vinod Dwarapudi
Vinod Dwarapudi el 25 de Jun. de 2021
I have changed the scaling of Contour plot and reduced the length of the antenna. Also replaced variable 'i' to 'xx' to not get confused between imaginary value 'i' and variable 'i'.
clear
clc
epsilon= 8.85e-12;%fre space permitivity
f = 3e9;%frequency
c = 3e8;%speed of light
w = 2*pi*f;%omega
lambda = c/f;%wavelength
B = 2*pi/lambda; %beta
dl = lambda/500; %length of antenna
dt=1/f/20;
I0 = 1;%current
[x,z]=meshgrid(-lambda:dl:lambda,-lambda:dl:lambda);
r = (x.^2+z.^2).^(1/2);
theta = atan(x./z);
n = B/(w*epsilon);
E1 = n*I0*dl/(2*pi);
E2 = cos(theta);
E3 = r.^(-2)-r.^(-3)*1i/B;
E4 = exp(-1i*B*r);
E =E1*E2.*E3.*E4;%r component of the field
n= 100;
% M = moviein(n);
M(n) = struct('cdata',[],'colormap',[]);%Initializing Matrix to store frames
h = figure;
ax = gca;
ax.NextPlot = 'replaceChildren';
h.Visible = 'off';%Hiding figure for speed up
v = -1:0.13:1;%parameter for scaling contour plots
for xx=1:n
t=xx*dt;
Et=real(E*exp(1j*w*t));%converting to time domain
contour(Et,v)
drawnow
M(xx) = getframe;
end
h.Visible = 'on';
movie(M);shg
Also, the dipole can be simulated using Antenna Toolbox. Below are some of the links that can help you with that :
d = dipole('Length',value) creates dipole of any required length. Refer below link to perform the analysis and get the impedance, radiation pattern etc...
  1 comentario
SHYAM
SHYAM el 29 de Mzo. de 2024
Excellent. In the same way , how to do for magnetic field and far fields? Please help me with the code snippet

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by