diff --git a/matlab/Tutorials/Conical_Horn_Antenna.m b/matlab/Tutorials/Conical_Horn_Antenna.m new file mode 100644 index 0000000..4b44edb --- /dev/null +++ b/matlab/Tutorials/Conical_Horn_Antenna.m @@ -0,0 +1,246 @@ +% +% Tutorials / conical horn antenna +% +% Describtion at: +% http://openems.de/index.php/Tutorial:_Conical_Horn_Antenna +% +% Tested with +% - Matlab 2011a +% - openEMS v0.0.25 +% +% (C) 2011 Thorsten Liebig + +close all +clear +clc + +%% setup the simulation +physical_constants; +unit = 1e-3; % all length in mm + +% horn radius +horn.radius = 20; +% horn length in z-direction +horn.length = 50; + +horn.feed_length = 50; + +horn.thickness = 2; + +% horn opening angle +horn.angle = 20*pi/180; + +% size of the simulation box +SimBox = [100 100 100]*2; + +% frequency range of interest +f_start = 10e9; +f_stop = 20e9; + +% frequency of interest +f0 = 15e9; + +%% mode functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% by David M. Pozar, Microwave Engineering, third edition, page 113 +freq = linspace(f_start,f_stop,201); + +p11 = 1.841; +kc = p11 / horn.radius /unit; +k = 2*pi*freq/C0; +fc = C0*kc/2/pi; +beta = sqrt(k.^2 - kc^2); +ZL_a = k * Z0 ./ beta; %analytic waveguide impedance + +% mode profile E- and H-field +kc = kc*unit +func_Er = [ num2str(-1/kc^2,'%14.13f') '/rho*cos(a)*j1(' num2str(kc,'%14.13f') '*rho)']; +func_Ea = [ num2str(1/kc,'%14.13f') '*sin(a)*0.5*(j0(' num2str(kc,'%14.13f') '*rho)-jn(2,' num2str(kc,'%14.13f') '*rho))']; +func_Ex = ['(' func_Er '*cos(a) - ' func_Ea '*sin(a) ) * (rho<' num2str(horn.radius) ')']; +func_Ey = ['(' func_Er '*sin(a) + ' func_Ea '*cos(a) ) * (rho<' num2str(horn.radius) ')']; + +func_Ha = [ num2str(-1/kc^2,'%14.13f') '/rho*cos(a)*j1(' num2str(kc,'%14.13f') '*rho)']; +func_Hr = [ '-1*' num2str(1/kc,'%14.13f') '*sin(a)*0.5*(j0(' num2str(kc,'%14.13f') '*rho)-jn(2,' num2str(kc,'%14.13f') '*rho))']; +func_Hx = ['(' func_Hr '*cos(a) - ' func_Ha '*sin(a) ) * (rho<' num2str(horn.radius) ')']; +func_Hy = ['(' func_Hr '*sin(a) + ' func_Ha '*cos(a) ) * (rho<' num2str(horn.radius) ')']; + +disp([' Cutoff frequencies for this mode and wavguide is: ' num2str(fc/1e9) ' GHz']); + +if (f_start + +close all +clear +clc + +%% setup the simulation +physical_constants; +unit = 1e-3; % all length in mm + +% horn width in x-direction +horn.width = 20; +% horn height in y-direction +horn.height = 30; +% horn length in z-direction +horn.length = 50; + +horn.feed_length = 50; + +horn.thickness = 2; + +% horn opening angle in x, y +horn.angle = [20 20]*pi/180; + +% size of the simulation box +SimBox = [200 200 200]; + +% frequency range of interest +f_start = 10e9; +f_stop = 20e9; + +% frequency of interest +f0 = 15e9; + +%waveguide TE-mode definition +m = 1; +n = 0; + +%% mode functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% by David M. Pozar, Microwave Engineering, third edition, page 113 +freq = linspace(f_start,f_stop,201); +a = horn.width; +b = horn.height; +k = 2*pi*freq/c0; +kc = sqrt((m*pi/a/unit)^2 + (n*pi/b/unit)^2); +fc = c0*kc/2/pi; %cut-off frequency +beta = sqrt(k.^2 - kc^2); %waveguide phase-constant +ZL_a = k * Z0 ./ beta; %analytic waveguide impedance + +% mode profile E- and H-field +x_pos = ['(x-' num2str(a/2) ')']; +y_pos = ['(y-' num2str(b/2) ')']; +func_Ex = [num2str( n/b/unit) '*cos(' num2str(m*pi/a) '*' x_pos ')*sin(' num2str(n*pi/b) '*' y_pos ')']; +func_Ey = [num2str(-m/a/unit) '*sin(' num2str(m*pi/a) '*' x_pos ')*cos(' num2str(n*pi/b) '*' y_pos ')']; + +func_Hx = [num2str(m/a/unit) '*sin(' num2str(m*pi/a) '*' x_pos ')*cos(' num2str(n*pi/b) '*' y_pos ')']; +func_Hy = [num2str(n/b/unit) '*cos(' num2str(m*pi/a) '*' x_pos ')*sin(' num2str(n*pi/b) '*' y_pos ')']; + +disp([' Cutoff frequencies for this mode and wavguide is: ' num2str(fc/1e9) ' GHz']); + +if (f_start