Home
Login
Register
Search
Home
Rectangular Waveguide Through Matlab
Rectangular Waveguide Through Matlab
March 20, 2018 | Author: Saloni Agarwal | Category:
Waveguide
,
Electrodynamics
,
Telecommunications Engineering
,
Electronic Engineering
,
Electromagnetism
DOWNLOAD
Share
Report this link
Comments
Description
Tutorial: Rectangular Waveguide Download the latest matlab file using gitweb: Rect_Waveguide.m Simulation Time: ~ 5 min for a 5m long waveguide We will cover in this tutorial: setup a mode profile excitation create voltage and current probes using the mode profile calculate the waveguide impedance and S-Parameter Contents [hide] 1 First Steps 2 Matlab Simulation Script 3 Post-Processing 4 Results 5 Modifications o 5.1 Return To Tutorials Index First Steps Install and verify your openEMS installation: Tutorial: First Steps Matlab Simulation Script Start the script within an empty environment: close all clear clc Setup the simulation parameter physical_constants; unit = 1e-3; %drawing unit in mm numTS = 50000; %max. number of timesteps % waveguide dimensions length = 5000; disp([' Cutoff frequencies for this mode and wavguide is: ' num2str(fc/1e6) ' MHz']). %waveguide TE-mode definition m = 1. this may result in a long simulation. fc = c0*kc/2/pi. . func_Hy = [num2str(n/b/unit) '*cos(' num2str(m*pi/a) '*x)*sin(' num2str(n*pi/b) '*y)']. '). func_Hx = [num2str(m/a/unit) '*sin(' num2str(m*pi/a) '*x)*cos(' num2str(n*pi/b) '*y)'].f_stop.and H-field func_Ex = [num2str( n/b/unit) '*cos(' num2str(m*pi/a) '*x)*sin(' num2str(n*pi/b) '*y)']. if (f_start<fc) warning('openEMS:example'. k = 2*pi*freq/c0. %waveguide phase-constant ZL_a = k * Z0 . end Set FDTD parameter and excitation time-signal FDTD = InitFDTD(numTS. f_stop = 500e6.. n = 1. %cut-off frequency beta = sqrt(k.1e-5). b = 1000.^2 . %analytic waveguide impedance % mode profile E. page 113 freq = linspace(f_start. %targeted mesh resolution Define the mode functions % by David M. third edition. func_Ey = [num2str(-m/a/unit) '*sin(' num2str(m*pi/a) '*x)*cos(' num2str(n*pi/b) '*y)'].a = 1000./ beta. kc = sqrt((m*pi/a/unit)^2 + (n*pi/b/unit)^2). Pozar.201). mesh_res = [10 10 10]. %waveguide width %waveguide heigth % frequency range of interest f_start = 300e6. Microwave Engineering.'f_start is smaller than the cutofffrequency..kc^2). and neg.start. 0 .start. 'ModeFunction'. []. Define the mode profile voltage and currents probes %port 1 start = [mesh.y(1) mesh.{func_Ex. 11. 'ut2'. 'ModeFunction'.0.x = SmoothMeshLines([0 a]. 'ut1'. CSX = AddProbe(CSX. CSX = AddBox(CSX. CSX = SetExcitationWeight(CSX. stop = [mesh.BC). mesh.start. z-direction FDTD = SetBoundaryCond(FDTD. CSX = AddBox(CSX.y(end) mesh.x(end) mesh. CSX = AddBox(CSX.0}). start=[mesh. []. 0 .{func_Ex.weight).'it1'. weight{2} = func_Ey. % boundary conditions BC = [0 0 0 0 3 3].x(1) mesh.x(end) mesh. 1.y(end) mesh. .0.'excite'. 0 . weight{1} = func_Ex.x(end) mesh. 'ModeFunction'.y(1) mesh. [].z(8) ].0}). %pml in pos. stop =[mesh.z(15)]. mesh.FDTD = SetGaussExcite(FDTD. CSX = AddProbe(CSX.'it1'. mesh_res(3)). mesh_res(2)).x(1) mesh. %port 2 start = [mesh. 1.0}).start.mesh).stop). mesh.func_Ey. Define the homogeneous mesh CSX = InitCSX(). CSX = DefineRectGrid(CSX.'excite'.stop).y = SmoothMeshLines([0 b]. weight{3} = 0. 10.z(end-14)].z(end-14)].stop). stop = [mesh.5*(f_stopf_start)). CSX = AddBox(CSX.stop). Apply the mode profile excitation % xy-mode profile excitation located directly on top of pml (first 8 z-lines) CSX = AddExcitation(CSX.func_Hy.x(1) mesh. 'ut1'.z(8) ].z = SmoothMeshLines([0 length].[1 1 0]). 1.5*(f_start+f_stop).z(15)].y(1) mesh.0. mesh_res(1)). 10. unit.'excite'. 'ut2'. CSX = AddProbe(CSX.func_Ey.{func_Hx.y(end) mesh.0 . I.5 * * * * ( ( ( ( uf1 if1 uf2 if2 + + + + if1 uf1 if2 uf2 .mesh. ).* .[Sim_Path '/']./Exc. Save & Run the simulation Sim_Path = 'tmp'.x(1) mesh.stop). = = = = 0.FDTD.if1. uf1 uf2 if1 if2 = = = = U. RunOpenEMS(Sim_Path.freq).5 0.z(1)].CSX). messageid] = mkdir(Sim_Path). Sim_CSX = 'rect_wg.xml'.x(end) mesh. Exc = ReadUI('et'.y(1) mesh.FD{1}.freq).start.z(end)]. start.'SubSampling'.val.uf1_inc. port_dist = mesh.FD{2}.{func_Hx. stop = [mesh. CSX = AddBox(CSX. [status. ). 'ModeFunction'.freq).'s').5 0. I = ReadUI({'it1'.'Et'.val.'FileType'.FD{1}.val.4. start = [mesh.z(end-14) . 11. [].'ut2'}./ ZL_a ZL_a ZL_a ZL_a ). if1_ref = if1_inc . . ).FD{1}.val. 0 .1./Exc.FD{2}. CSX = AddBox(CSX.val.0}).val.[Sim_Path '/']./ .0 . I.'it2'./Exc.4').'Et'.'4. 1.func_Hy. Define a dump box using the HDF5 file format CSX = AddDump(CSX.val. [status. Sim_CSX) Post-Processing Read all voltages and currents and calculate the incoming and reflected wave using the known analytic waveguide impedance U = ReadUI({'ut1'.Sim_Path. uf1_inc if1_inc uf2_inc if2_inc uf1_ref = uf1 .val.5 0. messageid] = rmdir(Sim_Path. message./Exc.z(15). message.FD{1}.FD{1}.'it2'}. U.CSX = AddProbe(CSX.'it2'.stop).y(end) mesh.* . WriteOpenEMS([Sim_Path '/' Sim_CSX].FD{1}. 'FontSize'.'Linewidth'.2)./uf1_inc. set(l.'FontSize'.real(ZL). PlotArgs.2).'FontSize'.12). hold on.12). plot(freq*1e-6.2).'Best').'Linewidth'. xlabel('frequency (MHz) \rightarrow'.'. PlotArgs./uf1_inc.imag(ZL). PlotHDF5FieldData(dump_file.12). ylabel('S-Parameter (dB)'.pauseTime=0.'Location'.'FontSize'. Visualize the electric field in the time domain using matlab figure dump_file = [Sim_Path '/Et.h5']. plot(freq*1e-6.Limit = 'auto'. set(l.uf2_ref = uf2 . plot(freq*1e-6.2).slice = {a/2*unit b/2*unit 0}. PlotArgs. grid on.'Linewidth'.12).12).2).if2. ylabel('ZL (\Omega)'. if2_ref = if2_inc . l = legend('\Re(Z_L)'. hold on.'r--'.'k-'.'r--'.'FontSize'.'Linewidth'. xlim([freq(1) freq(end)]*1e-6).uf2_inc. Calculate & Plot the FDTD extracted waveguide impedance figure ZL = uf1. xlim([freq(1) freq(end)]*1e-6). Calculate & Plot the S-Parameter figure s11 = uf1_ref.20*log10(abs(s21)).'Best').20*log10(abs(s11)). PlotArgs.component=0.'Location'.'g-./if1.'\Im(Z_L)'.'Z_L analytic'. xlabel('frequency (MHz) \rightarrow'.ZL_a.'S_{21}'. s21 = uf2_inc.'Linewidth'. grid on. plot(freq*1e-6.'FontSize'. PlotArgs) Results .12). plot(freq*1e-6. l = legend('S_{11}'.01. Waveguide line impedance Waveguide scattering parameter Modifications Try different/multiple modes for excitation/detection Add an unsymmetrical dielectric material load to see a mode-conversion (multiple mode detection necessary) Try adding a periodic dielectric material to see a frequency selective reflection (Bragg reflections) .
Report "Rectangular Waveguide Through Matlab"
×
Please fill this form, we will try to respond as soon as possible.
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
Copyright © 2024 DOKUMEN.SITE Inc.