Simulating a hertzian dipole
Afficher commentaires plus anciens
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!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Analysis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
