diff --git a/Tutorials/Rect_Waveguide.m b/Tutorials/Rect_Waveguide.m new file mode 100644 index 0000000..fb690c9 --- /dev/null +++ b/Tutorials/Rect_Waveguide.m @@ -0,0 +1,176 @@ +% +% Tutorials / Rect_Waveguide +% +% Describtion at: +% http://openems.de/index.php/Tutorial:_Rectangular_Waveguide +% +% Tested with +% - Matlab 2009b +% - openEMS v0.0.23 +% +% (C) 2010,2011 Thorsten Liebig + +close all +clear +clc + +%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +physical_constants; +unit = 1e-3; %drawing unit in mm +numTS = 50000; %max. number of timesteps + +% waveguide dimensions +length = 5000; +a = 1000; %waveguide width +b = 1000; %waveguide heigth + +% frequency range of interest +f_start = 300e6; +f_stop = 500e6; + +%waveguide TE-mode definition +m = 1; +n = 1; + +mesh_res = [10 10 10]; %targeted mesh resolution + +%% mode functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% by David M. Pozar, Microwave Engineering, third edition, page 113 +freq = linspace(f_start,f_stop,201); +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 +func_Ex = [num2str( n/b/unit) '*cos(' num2str(m*pi/a) '*x)*sin(' num2str(n*pi/b) '*y)']; +func_Ey = [num2str(-m/a/unit) '*sin(' num2str(m*pi/a) '*x)*cos(' num2str(n*pi/b) '*y)']; + +func_Hx = [num2str(m/a/unit) '*sin(' num2str(m*pi/a) '*x)*cos(' num2str(n*pi/b) '*y)']; +func_Hy = [num2str(n/b/unit) '*cos(' num2str(m*pi/a) '*x)*sin(' num2str(n*pi/b) '*y)']; + +disp([' Cutoff frequencies for this mode and wavguide is: ' num2str(fc/1e6) ' MHz']); + +if (f_start