
Simulating a hertzian dipole
    13 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    basem ehab
 am 24 Jul. 2017
  
    
    
    
    
    Kommentiert: SHYAM
 am 29 Mär. 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!
0 Kommentare
Akzeptierte Antwort
  Vinod Dwarapudi
    
 am 25 Jun. 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 Kommentar
  SHYAM
 am 29 Mär. 2024
				Excellent. In the same way , how to do for magnetic field and far fields? Please help me with the code snippet
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Analysis finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


