diff --git a/matlab/Tutorials/CRLH_Extraction.m b/matlab/Tutorials/CRLH_Extraction.m index bb8f66f..d80a800 100644 --- a/matlab/Tutorials/CRLH_Extraction.m +++ b/matlab/Tutorials/CRLH_Extraction.m @@ -5,10 +5,10 @@ % http://openems.de/index.php/Tutorial:_CRLH_Extraction % % Tested with -% - Matlab 2009b -% - openEMS v0.0.23 +% - Matlab 2011a / Octave 3.4.3 +% - openEMS v0.0.26 % -% (C) 2011 Thorsten Liebig +% (C) 2011,2012 Thorsten Liebig close all clear @@ -38,7 +38,7 @@ f_start = 0.8e9; f_stop = 6e9; %% setup FDTD parameters & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%% -FDTD = InitFDTD( 20000, 1e-6, 'OverSampling', 10 ); +FDTD = InitFDTD( 20000 ); FDTD = SetGaussExcite( FDTD, (f_start+f_stop)/2, (f_stop-f_start)/2 ); BC = {'PML_8' 'PML_8' 'MUR' 'MUR' 'PEC' 'PML_8'}; FDTD = SetBoundaryCond( FDTD, BC ); diff --git a/matlab/Tutorials/CRLH_LeakyWaveAnt.m b/matlab/Tutorials/CRLH_LeakyWaveAnt.m index 7bbe29c..8803368 100644 --- a/matlab/Tutorials/CRLH_LeakyWaveAnt.m +++ b/matlab/Tutorials/CRLH_LeakyWaveAnt.m @@ -5,10 +5,10 @@ % http://openems.de/index.php/Tutorial:_CRLH_Leaky_Wave_Antenna % % Tested with -% - Matlab 2009b -% - openEMS v0.0.23 +% - Matlab 2011a / Octave 3.4.3 +% - openEMS v0.0.26 % -% (C) 2011 Thorsten Liebig +% (C) 2011,2012 Thorsten Liebig close all clear @@ -47,7 +47,7 @@ f_rad = (1.9:0.1:4.2)*1e9; Plot_3D_Rad_Pattern = 0; %this may take a very very long time! > 7h %% setup FDTD parameters & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%% -FDTD = InitFDTD( 20000, 1e-6, 'OverSampling', 10 ); +FDTD = InitFDTD( 20000 ); FDTD = SetGaussExcite( FDTD, (f_start+f_stop)/2, (f_stop-f_start)/2 ); BC = {'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8'}; FDTD = SetBoundaryCond( FDTD, BC ); @@ -136,6 +136,7 @@ ylabel('S-Parameter (dB)','FontSize',12); xlabel('frequency (GHz) \rightarrow','FontSize',12); ylim([-40 2]); +drawnow %% NFFF contour plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% thetaRange = (0:3:359) - 180; @@ -214,5 +215,7 @@ for n=1:numel(f_rad) zlim([-4 10]); title(['f=' num2str(f_res*1e-9,3) 'GHz - D=' num2str(Dlog(n),3) 'dBi'],'FontSize',12) pause(0.5) + + DumpFF2VTK( [Sim_Path '/FF_Pattern_' int2str(f_res/1e6) 'MHz.vtk'],E_far_normalized_3D,thetaRange,phiRange,1e-3); end diff --git a/matlab/Tutorials/Circ_Waveguide.m b/matlab/Tutorials/Circ_Waveguide.m index 13e0559..afa4e34 100644 --- a/matlab/Tutorials/Circ_Waveguide.m +++ b/matlab/Tutorials/Circ_Waveguide.m @@ -5,10 +5,10 @@ % http://openems.de/index.php/Tutorial:_Circular_Waveguide % % Tested with -% - Matlab 2009b -% - openEMS v0.0.23 +% - Matlab 2011a / Octave 3.4.3 +% - openEMS v0.0.26 % -% (C) 2010,2011 Thorsten Liebig +% (C) 2010-2012 Thorsten Liebig close all clear @@ -17,7 +17,6 @@ clc %% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% physical_constants; unit = 1e-3; %drawing unit in mm -numTS = 50000; %max. number of timesteps % waveguide dimensions length = 2000; @@ -55,7 +54,7 @@ if (f_start +% (C) 2011,2012 Thorsten Liebig close all clear @@ -52,7 +52,7 @@ beta = sqrt(k.^2 - kc^2); ZL_a = k * Z0 ./ beta; %analytic waveguide impedance % mode profile E- and H-field -kc = kc*unit +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) ')']; @@ -70,7 +70,7 @@ if (f_start +% (C) 2011,2012 Thorsten Liebig close all clear @@ -28,7 +28,7 @@ exite_offset = 1300; excite_angle = 45; %% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%% -FDTD = InitCylindricalFDTD(100000,1e-4,'OverSampling',5,'MultiGrid',split); +FDTD = InitFDTD(100000,1e-4,'CoordSystem',1,'MultiGrid',split); FDTD = SetGaussExcite(FDTD,f0,f0/2); BC = [0 3 0 0 0 0]; % pml in positive r-direction FDTD = SetBoundaryCond(FDTD,BC); @@ -73,6 +73,9 @@ Sim_CSX = '2D_CC_Wave.xml'; WriteOpenEMS([Sim_Path '/' Sim_CSX],FDTD,CSX); RunOpenEMS(Sim_Path, Sim_CSX); +%% +disp('use Paraview to visualize the vtk field dump...'); + %% [field mesh_h5] = ReadHDF5Dump([Sim_Path '/Ef_ra.h5']); diff --git a/matlab/Tutorials/Horn_Antenna.m b/matlab/Tutorials/Horn_Antenna.m index 1d7b61d..04cbb25 100644 --- a/matlab/Tutorials/Horn_Antenna.m +++ b/matlab/Tutorials/Horn_Antenna.m @@ -5,10 +5,10 @@ % http://openems.de/index.php/Tutorial:_Horn_Antenna % % Tested with -% - Matlab 2011a -% - openEMS v0.0.25 +% - Matlab 2011a / Octave 3.4.3 +% - openEMS v0.0.26 % -% (C) 2011 Thorsten Liebig +% (C) 2011,2012 Thorsten Liebig close all clear @@ -73,7 +73,7 @@ if (f_start +% (C) 2011,2012 Thorsten Liebig close all clear @@ -25,7 +25,7 @@ stub_length = 12e3; f_max = 7e9; %% setup FDTD parameters & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%% -FDTD = InitFDTD( 20000, 1e-6, 'OverSampling', 10 ); +FDTD = InitFDTD(); FDTD = SetGaussExcite( FDTD, f_max/2, f_max/2 ); BC = {'PML_8' 'PML_8' 'MUR' 'MUR' 'PEC' 'MUR'}; FDTD = SetBoundaryCond( FDTD, BC ); @@ -86,8 +86,7 @@ plot(f/1e9,20*log10(abs(s11)),'k-','LineWidth',2); hold on; grid on; plot(f/1e9,20*log10(abs(s21)),'r--','LineWidth',2); -l = legend('S_{11}','S_{21}','Location','Best'); -set(l,'FontSize',12); +legend('S_{11}','S_{21}'); ylabel('S-Parameter (dB)','FontSize',12); xlabel('frequency (GHz) \rightarrow','FontSize',12); ylim([-40 2]); diff --git a/matlab/Tutorials/Parallel_Plate_Waveguide.m b/matlab/Tutorials/Parallel_Plate_Waveguide.m new file mode 100644 index 0000000..89377a7 --- /dev/null +++ b/matlab/Tutorials/Parallel_Plate_Waveguide.m @@ -0,0 +1,51 @@ +% +% Tutorials / Parallel_Plate_Waveguide +% +% Describtion at: +% http://openems.de/index.php/Tutorial:_Parallel_Plate_Waveguide +% +% Tested with +% - Matlab 2011a / Octave 3.4.3 +% - openEMS v0.0.26 +% +% (C) 2011,2012 Sebastian Held +% (C) 2011,2012 Thorsten Liebig + +close all +clear +clc + +% init and define FDTD parameter +FDTD = InitFDTD(100,0,'OverSampling',50); +FDTD = SetSinusExcite(FDTD,10e6); +BC = {'PMC' 'PMC' 'PEC' 'PEC' 'MUR' 'MUR'}; +FDTD = SetBoundaryCond(FDTD,BC); + +% init and define FDTD mesh +CSX = InitCSX(); +mesh.x = -10:10; +mesh.y = -10:10; +mesh.z = -10:30; +CSX = DefineRectGrid(CSX, 1, mesh); + +% define the excitation +CSX = AddExcitation(CSX,'excitation',0,[0 1 0]); +CSX = AddBox(CSX,'excitation',0,[-10 -10 0],[10 10 0]); + +% define a time domain e-field dump box +CSX = AddDump(CSX,'Et','DumpMode',0); +CSX = AddBox(CSX,'Et',0,[-10 0 -10],[10 0 30]); + +% remove old simulation results (if exist) +rmdir('tmp','s');mkdir('tmp'); + +% write openEMS xml data file +WriteOpenEMS('tmp/tmp.xml',FDTD,CSX); + +% view defined structure +CSXGeomPlot( 'tmp/tmp.xml' ); + +% run openEMS simulation +RunOpenEMS('tmp','tmp.xml',''); + +disp('use Paraview to visualize the FDTD result...'); diff --git a/matlab/Tutorials/Rect_Waveguide.m b/matlab/Tutorials/Rect_Waveguide.m index fb690c9..8a7dd7c 100644 --- a/matlab/Tutorials/Rect_Waveguide.m +++ b/matlab/Tutorials/Rect_Waveguide.m @@ -5,10 +5,10 @@ % http://openems.de/index.php/Tutorial:_Rectangular_Waveguide % % Tested with -% - Matlab 2009b -% - openEMS v0.0.23 +% - Matlab 2011a / Octave 3.4.3 +% - openEMS v0.0.26 % -% (C) 2010,2011 Thorsten Liebig +% (C) 2010-2012 Thorsten Liebig close all clear @@ -57,7 +57,7 @@ if (f_start +% (C) 2010-2012 Thorsten Liebig close all clear @@ -40,9 +40,9 @@ feed.R = 50; %feed resistance SimBox = [200 200 100]; %% setup FDTD parameter & excitation function -f0 = 0e9; % center frequency -fc = 3e9; % 20 dB corner frequency (in this case 0 Hz - 3e9 Hz) -FDTD = InitFDTD( 30000, 1e-5 ); +f0 = 2e9; % center frequency +fc = 1e9; % 20 dB corner frequency +FDTD = InitFDTD( 30000 ); FDTD = SetGaussExcite( FDTD, f0, fc ); BC = {'MUR' 'MUR' 'MUR' 'MUR' 'MUR' 'MUR'}; % boundary conditions FDTD = SetBoundaryCond( FDTD, BC ); @@ -141,6 +141,8 @@ ylabel( 'reflection coefficient |S_{11}|' ); P_in = 0.5*U.FD{1}.val .* conj( I.FD{1}.val ); % antenna feed power +drawnow + %% NFFF contour plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %find resonance frequncy from s11 f_res_ind = find(s11==min(s11));