Simulating a hertzian dipole
이전 댓글 표시
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!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
