Matlab tutorial updates and tests
This commit is contained in:
parent
afd11bcc4a
commit
c485f041ec
@ -5,10 +5,10 @@
|
|||||||
% http://openems.de/index.php/Tutorial:_CRLH_Extraction
|
% http://openems.de/index.php/Tutorial:_CRLH_Extraction
|
||||||
%
|
%
|
||||||
% Tested with
|
% Tested with
|
||||||
% - Matlab 2009b
|
% - Matlab 2011a / Octave 3.4.3
|
||||||
% - openEMS v0.0.23
|
% - openEMS v0.0.26
|
||||||
%
|
%
|
||||||
% (C) 2011 Thorsten Liebig <thorsten.liebig@gmx.de>
|
% (C) 2011,2012 Thorsten Liebig <thorsten.liebig@gmx.de>
|
||||||
|
|
||||||
close all
|
close all
|
||||||
clear
|
clear
|
||||||
@ -38,7 +38,7 @@ f_start = 0.8e9;
|
|||||||
f_stop = 6e9;
|
f_stop = 6e9;
|
||||||
|
|
||||||
%% setup FDTD parameters & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% 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 );
|
FDTD = SetGaussExcite( FDTD, (f_start+f_stop)/2, (f_stop-f_start)/2 );
|
||||||
BC = {'PML_8' 'PML_8' 'MUR' 'MUR' 'PEC' 'PML_8'};
|
BC = {'PML_8' 'PML_8' 'MUR' 'MUR' 'PEC' 'PML_8'};
|
||||||
FDTD = SetBoundaryCond( FDTD, BC );
|
FDTD = SetBoundaryCond( FDTD, BC );
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
% http://openems.de/index.php/Tutorial:_CRLH_Leaky_Wave_Antenna
|
% http://openems.de/index.php/Tutorial:_CRLH_Leaky_Wave_Antenna
|
||||||
%
|
%
|
||||||
% Tested with
|
% Tested with
|
||||||
% - Matlab 2009b
|
% - Matlab 2011a / Octave 3.4.3
|
||||||
% - openEMS v0.0.23
|
% - openEMS v0.0.26
|
||||||
%
|
%
|
||||||
% (C) 2011 Thorsten Liebig <thorsten.liebig@gmx.de>
|
% (C) 2011,2012 Thorsten Liebig <thorsten.liebig@gmx.de>
|
||||||
|
|
||||||
close all
|
close all
|
||||||
clear
|
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
|
Plot_3D_Rad_Pattern = 0; %this may take a very very long time! > 7h
|
||||||
|
|
||||||
%% setup FDTD parameters & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% 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 );
|
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'};
|
BC = {'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8'};
|
||||||
FDTD = SetBoundaryCond( FDTD, BC );
|
FDTD = SetBoundaryCond( FDTD, BC );
|
||||||
@ -136,6 +136,7 @@ ylabel('S-Parameter (dB)','FontSize',12);
|
|||||||
xlabel('frequency (GHz) \rightarrow','FontSize',12);
|
xlabel('frequency (GHz) \rightarrow','FontSize',12);
|
||||||
ylim([-40 2]);
|
ylim([-40 2]);
|
||||||
|
|
||||||
|
drawnow
|
||||||
|
|
||||||
%% NFFF contour plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% NFFF contour plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
thetaRange = (0:3:359) - 180;
|
thetaRange = (0:3:359) - 180;
|
||||||
@ -214,5 +215,7 @@ for n=1:numel(f_rad)
|
|||||||
zlim([-4 10]);
|
zlim([-4 10]);
|
||||||
title(['f=' num2str(f_res*1e-9,3) 'GHz - D=' num2str(Dlog(n),3) 'dBi'],'FontSize',12)
|
title(['f=' num2str(f_res*1e-9,3) 'GHz - D=' num2str(Dlog(n),3) 'dBi'],'FontSize',12)
|
||||||
pause(0.5)
|
pause(0.5)
|
||||||
|
|
||||||
|
DumpFF2VTK( [Sim_Path '/FF_Pattern_' int2str(f_res/1e6) 'MHz.vtk'],E_far_normalized_3D,thetaRange,phiRange,1e-3);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
% http://openems.de/index.php/Tutorial:_Circular_Waveguide
|
% http://openems.de/index.php/Tutorial:_Circular_Waveguide
|
||||||
%
|
%
|
||||||
% Tested with
|
% Tested with
|
||||||
% - Matlab 2009b
|
% - Matlab 2011a / Octave 3.4.3
|
||||||
% - openEMS v0.0.23
|
% - openEMS v0.0.26
|
||||||
%
|
%
|
||||||
% (C) 2010,2011 Thorsten Liebig <thorsten.liebig@gmx.de>
|
% (C) 2010-2012 Thorsten Liebig <thorsten.liebig@gmx.de>
|
||||||
|
|
||||||
close all
|
close all
|
||||||
clear
|
clear
|
||||||
@ -17,7 +17,6 @@ clc
|
|||||||
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup the simulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
physical_constants;
|
physical_constants;
|
||||||
unit = 1e-3; %drawing unit in mm
|
unit = 1e-3; %drawing unit in mm
|
||||||
numTS = 50000; %max. number of timesteps
|
|
||||||
|
|
||||||
% waveguide dimensions
|
% waveguide dimensions
|
||||||
length = 2000;
|
length = 2000;
|
||||||
@ -55,7 +54,7 @@ if (f_start<fc)
|
|||||||
end
|
end
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FDTD = InitCylindricalFDTD(numTS,1e-5,'OverSampling',6);
|
FDTD = InitFDTD(1e6,1e-5,'CoordSystem',1);
|
||||||
FDTD = SetGaussExcite(FDTD,0.5*(f_start+f_stop),0.5*(f_stop-f_start));
|
FDTD = SetGaussExcite(FDTD,0.5*(f_start+f_stop),0.5*(f_stop-f_start));
|
||||||
|
|
||||||
% boundary conditions
|
% boundary conditions
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
% http://openems.de/index.php/Tutorial:_Conical_Horn_Antenna
|
% http://openems.de/index.php/Tutorial:_Conical_Horn_Antenna
|
||||||
%
|
%
|
||||||
% Tested with
|
% Tested with
|
||||||
% - Matlab 2011a
|
% - Matlab 2011a / Octave 3.4.3
|
||||||
% - openEMS v0.0.25
|
% - openEMS v0.0.26
|
||||||
%
|
%
|
||||||
% (C) 2011 Thorsten Liebig <thorsten.liebig@uni-due.de>
|
% (C) 2011,2012 Thorsten Liebig <thorsten.liebig@uni-due.de>
|
||||||
|
|
||||||
close all
|
close all
|
||||||
clear
|
clear
|
||||||
@ -52,7 +52,7 @@ beta = sqrt(k.^2 - kc^2);
|
|||||||
ZL_a = k * Z0 ./ beta; %analytic waveguide impedance
|
ZL_a = k * Z0 ./ beta; %analytic waveguide impedance
|
||||||
|
|
||||||
% mode profile E- and H-field
|
% 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_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_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_Ex = ['(' func_Er '*cos(a) - ' func_Ea '*sin(a) ) * (rho<' num2str(horn.radius) ')'];
|
||||||
@ -70,7 +70,7 @@ if (f_start<fc)
|
|||||||
end
|
end
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function
|
%% setup FDTD parameter & excitation function
|
||||||
FDTD = InitFDTD( 30000, 1e-5 );
|
FDTD = InitFDTD( 30000 );
|
||||||
FDTD = SetGaussExcite(FDTD,0.5*(f_start+f_stop),0.5*(f_stop-f_start));
|
FDTD = SetGaussExcite(FDTD,0.5*(f_start+f_stop),0.5*(f_stop-f_start));
|
||||||
BC = {'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8'}; % boundary conditions
|
BC = {'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8'}; % boundary conditions
|
||||||
FDTD = SetBoundaryCond( FDTD, BC );
|
FDTD = SetBoundaryCond( FDTD, BC );
|
||||||
@ -126,7 +126,7 @@ CSX = AddCylinder(CSX,'excite',0 ,start,stop,horn.radius);
|
|||||||
%% voltage and current definitions using the mode matching probes %%%%%%%%%
|
%% voltage and current definitions using the mode matching probes %%%%%%%%%
|
||||||
%port 1
|
%port 1
|
||||||
start = [-horn.radius -horn.radius mesh.z(1)+horn.feed_length/2];
|
start = [-horn.radius -horn.radius mesh.z(1)+horn.feed_length/2];
|
||||||
stop = [ horn.radius horn.radius mesh.z(1)+horn.feed_length/2]
|
stop = [ horn.radius horn.radius mesh.z(1)+horn.feed_length/2];
|
||||||
CSX = AddProbe(CSX, 'ut1', 10, 1, [], 'ModeFunction',{func_Ex,func_Ey,0});
|
CSX = AddProbe(CSX, 'ut1', 10, 1, [], 'ModeFunction',{func_Ex,func_Ey,0});
|
||||||
CSX = AddBox(CSX, 'ut1', 0 ,start,stop);
|
CSX = AddBox(CSX, 'ut1', 0 ,start,stop);
|
||||||
CSX = AddProbe(CSX,'it1', 11, 1, [], 'ModeFunction',{func_Hx,func_Hy,0});
|
CSX = AddProbe(CSX,'it1', 11, 1, [], 'ModeFunction',{func_Hx,func_Hy,0});
|
||||||
@ -151,7 +151,7 @@ WriteOpenEMS( [Sim_Path '/' Sim_CSX], FDTD, CSX );
|
|||||||
CSXGeomPlot( [Sim_Path '/' Sim_CSX] );
|
CSXGeomPlot( [Sim_Path '/' Sim_CSX] );
|
||||||
|
|
||||||
%% run openEMS
|
%% run openEMS
|
||||||
RunOpenEMS( Sim_Path, Sim_CSX ,'--debug-PEC');
|
RunOpenEMS( Sim_Path, Sim_CSX);
|
||||||
|
|
||||||
%% postprocessing & do the plots
|
%% postprocessing & do the plots
|
||||||
U = ReadUI( 'ut1', Sim_Path, freq ); % time domain/freq domain voltage
|
U = ReadUI( 'ut1', Sim_Path, freq ); % time domain/freq domain voltage
|
||||||
@ -173,6 +173,8 @@ ylabel( 'reflection coefficient |S_{11}|' );
|
|||||||
|
|
||||||
P_in = 0.5*uf_inc .* conj( if_inc ); % antenna feed power
|
P_in = 0.5*uf_inc .* conj( if_inc ); % antenna feed power
|
||||||
|
|
||||||
|
drawnow
|
||||||
|
|
||||||
%% NFFF contour plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% NFFF contour plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
% calculate the far field at phi=0 degrees and at phi=90 degrees
|
% calculate the far field at phi=0 degrees and at phi=90 degrees
|
||||||
@ -243,4 +245,4 @@ ylabel( 'y' );
|
|||||||
zlabel( 'z' );
|
zlabel( 'z' );
|
||||||
|
|
||||||
%%
|
%%
|
||||||
DumpFF2VTK('Conical_Horn_Pattern.vtk',E_far_normalized,thetaRange,phiRange,1e-3);
|
DumpFF2VTK([Sim_Path '/Conical_Horn_Pattern.vtk'],E_far_normalized,thetaRange,phiRange,1e-3);
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
% http://openems.de/index.php/Tutorial:_2D_Cylindrical_Wave
|
% http://openems.de/index.php/Tutorial:_2D_Cylindrical_Wave
|
||||||
%
|
%
|
||||||
% Tested with
|
% Tested with
|
||||||
% - Matlab 2009b
|
% - Matlab 2011a/ Octave 3.4.3
|
||||||
% - openEMS v0.0.23
|
% - openEMS v0.0.26
|
||||||
%
|
%
|
||||||
% (C) 2011 Thorsten Liebig <thorsten.liebig@gmx.de>
|
% (C) 2011,2012 Thorsten Liebig <thorsten.liebig@gmx.de>
|
||||||
|
|
||||||
close all
|
close all
|
||||||
clear
|
clear
|
||||||
@ -28,7 +28,7 @@ exite_offset = 1300;
|
|||||||
excite_angle = 45;
|
excite_angle = 45;
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% 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);
|
FDTD = SetGaussExcite(FDTD,f0,f0/2);
|
||||||
BC = [0 3 0 0 0 0]; % pml in positive r-direction
|
BC = [0 3 0 0 0 0]; % pml in positive r-direction
|
||||||
FDTD = SetBoundaryCond(FDTD,BC);
|
FDTD = SetBoundaryCond(FDTD,BC);
|
||||||
@ -73,6 +73,9 @@ Sim_CSX = '2D_CC_Wave.xml';
|
|||||||
WriteOpenEMS([Sim_Path '/' Sim_CSX],FDTD,CSX);
|
WriteOpenEMS([Sim_Path '/' Sim_CSX],FDTD,CSX);
|
||||||
RunOpenEMS(Sim_Path, Sim_CSX);
|
RunOpenEMS(Sim_Path, Sim_CSX);
|
||||||
|
|
||||||
|
%%
|
||||||
|
disp('use Paraview to visualize the vtk field dump...');
|
||||||
|
|
||||||
%%
|
%%
|
||||||
[field mesh_h5] = ReadHDF5Dump([Sim_Path '/Ef_ra.h5']);
|
[field mesh_h5] = ReadHDF5Dump([Sim_Path '/Ef_ra.h5']);
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
% http://openems.de/index.php/Tutorial:_Horn_Antenna
|
% http://openems.de/index.php/Tutorial:_Horn_Antenna
|
||||||
%
|
%
|
||||||
% Tested with
|
% Tested with
|
||||||
% - Matlab 2011a
|
% - Matlab 2011a / Octave 3.4.3
|
||||||
% - openEMS v0.0.25
|
% - openEMS v0.0.26
|
||||||
%
|
%
|
||||||
% (C) 2011 Thorsten Liebig <thorsten.liebig@uni-due.de>
|
% (C) 2011,2012 Thorsten Liebig <thorsten.liebig@uni-due.de>
|
||||||
|
|
||||||
close all
|
close all
|
||||||
clear
|
clear
|
||||||
@ -73,7 +73,7 @@ if (f_start<fc)
|
|||||||
end
|
end
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function
|
%% setup FDTD parameter & excitation function
|
||||||
FDTD = InitFDTD( 30000, 1e-5 );
|
FDTD = InitFDTD( 30000, 1e-4 );
|
||||||
FDTD = SetGaussExcite(FDTD,0.5*(f_start+f_stop),0.5*(f_stop-f_start));
|
FDTD = SetGaussExcite(FDTD,0.5*(f_start+f_stop),0.5*(f_stop-f_start));
|
||||||
BC = {'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8'}; % boundary conditions
|
BC = {'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PML_8'}; % boundary conditions
|
||||||
FDTD = SetBoundaryCond( FDTD, BC );
|
FDTD = SetBoundaryCond( FDTD, BC );
|
||||||
@ -199,6 +199,8 @@ ylabel( 'reflection coefficient |S_{11}|' );
|
|||||||
|
|
||||||
P_in = 0.5*uf_inc .* conj( if_inc ); % antenna feed power
|
P_in = 0.5*uf_inc .* conj( if_inc ); % antenna feed power
|
||||||
|
|
||||||
|
drawnow
|
||||||
|
|
||||||
%% NFFF contour plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% NFFF contour plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
% calculate the far field at phi=0 degrees and at phi=90 degrees
|
% calculate the far field at phi=0 degrees and at phi=90 degrees
|
||||||
@ -269,4 +271,4 @@ ylabel( 'y' );
|
|||||||
zlabel( 'z' );
|
zlabel( 'z' );
|
||||||
|
|
||||||
%%
|
%%
|
||||||
DumpFF2VTK('Horn_Pattern.vtk',E_far_normalized,thetaRange,phiRange,1e-3);
|
DumpFF2VTK([Sim_Path '/Horn_Pattern.vtk'],E_far_normalized,thetaRange,phiRange,1e-3);
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
% http://openems.de/index.php/Tutorial:_Microstrip_Notch_Filter
|
% http://openems.de/index.php/Tutorial:_Microstrip_Notch_Filter
|
||||||
%
|
%
|
||||||
% Tested with
|
% Tested with
|
||||||
% - Matlab 2009b
|
% - Matlab 2011a / Octave 3.4.3
|
||||||
% - openEMS v0.0.23
|
% - openEMS v0.0.26
|
||||||
%
|
%
|
||||||
% (C) 2011 Thorsten Liebig <thorsten.liebig@gmx.de>
|
% (C) 2011,2012 Thorsten Liebig <thorsten.liebig@gmx.de>
|
||||||
|
|
||||||
close all
|
close all
|
||||||
clear
|
clear
|
||||||
@ -25,7 +25,7 @@ stub_length = 12e3;
|
|||||||
f_max = 7e9;
|
f_max = 7e9;
|
||||||
|
|
||||||
%% setup FDTD parameters & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup FDTD parameters & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FDTD = InitFDTD( 20000, 1e-6, 'OverSampling', 10 );
|
FDTD = InitFDTD();
|
||||||
FDTD = SetGaussExcite( FDTD, f_max/2, f_max/2 );
|
FDTD = SetGaussExcite( FDTD, f_max/2, f_max/2 );
|
||||||
BC = {'PML_8' 'PML_8' 'MUR' 'MUR' 'PEC' 'MUR'};
|
BC = {'PML_8' 'PML_8' 'MUR' 'MUR' 'PEC' 'MUR'};
|
||||||
FDTD = SetBoundaryCond( FDTD, BC );
|
FDTD = SetBoundaryCond( FDTD, BC );
|
||||||
@ -86,8 +86,7 @@ plot(f/1e9,20*log10(abs(s11)),'k-','LineWidth',2);
|
|||||||
hold on;
|
hold on;
|
||||||
grid on;
|
grid on;
|
||||||
plot(f/1e9,20*log10(abs(s21)),'r--','LineWidth',2);
|
plot(f/1e9,20*log10(abs(s21)),'r--','LineWidth',2);
|
||||||
l = legend('S_{11}','S_{21}','Location','Best');
|
legend('S_{11}','S_{21}');
|
||||||
set(l,'FontSize',12);
|
|
||||||
ylabel('S-Parameter (dB)','FontSize',12);
|
ylabel('S-Parameter (dB)','FontSize',12);
|
||||||
xlabel('frequency (GHz) \rightarrow','FontSize',12);
|
xlabel('frequency (GHz) \rightarrow','FontSize',12);
|
||||||
ylim([-40 2]);
|
ylim([-40 2]);
|
||||||
|
51
matlab/Tutorials/Parallel_Plate_Waveguide.m
Normal file
51
matlab/Tutorials/Parallel_Plate_Waveguide.m
Normal file
@ -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 <sebastian.held@gmx.de>
|
||||||
|
% (C) 2011,2012 Thorsten Liebig <thorsten.liebig@gmx.de>
|
||||||
|
|
||||||
|
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...');
|
@ -5,10 +5,10 @@
|
|||||||
% http://openems.de/index.php/Tutorial:_Rectangular_Waveguide
|
% http://openems.de/index.php/Tutorial:_Rectangular_Waveguide
|
||||||
%
|
%
|
||||||
% Tested with
|
% Tested with
|
||||||
% - Matlab 2009b
|
% - Matlab 2011a / Octave 3.4.3
|
||||||
% - openEMS v0.0.23
|
% - openEMS v0.0.26
|
||||||
%
|
%
|
||||||
% (C) 2010,2011 Thorsten Liebig <thorsten.liebig@gmx.de>
|
% (C) 2010-2012 Thorsten Liebig <thorsten.liebig@gmx.de>
|
||||||
|
|
||||||
close all
|
close all
|
||||||
clear
|
clear
|
||||||
@ -57,7 +57,7 @@ if (f_start<fc)
|
|||||||
end
|
end
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% setup FDTD parameter & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FDTD = InitFDTD(numTS,1e-5,'OverSampling',6);
|
FDTD = InitFDTD(numTS,1e-5);
|
||||||
FDTD = SetGaussExcite(FDTD,0.5*(f_start+f_stop),0.5*(f_stop-f_start));
|
FDTD = SetGaussExcite(FDTD,0.5*(f_start+f_stop),0.5*(f_stop-f_start));
|
||||||
|
|
||||||
% boundary conditions
|
% boundary conditions
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
% http://openems.de/index.php/Tutorial:_Simple_Patch_Antenna
|
% http://openems.de/index.php/Tutorial:_Simple_Patch_Antenna
|
||||||
%
|
%
|
||||||
% Tested with
|
% Tested with
|
||||||
% - Matlab 2009b
|
% - Matlab 2011a / Octave 3.4.3
|
||||||
% - openEMS v0.0.23
|
% - openEMS v0.0.26
|
||||||
%
|
%
|
||||||
% (C) 2010,2011 Thorsten Liebig <thorsten.liebig@uni-due.de>
|
% (C) 2010-2012 Thorsten Liebig <thorsten.liebig@uni-due.de>
|
||||||
|
|
||||||
close all
|
close all
|
||||||
clear
|
clear
|
||||||
@ -40,9 +40,9 @@ feed.R = 50; %feed resistance
|
|||||||
SimBox = [200 200 100];
|
SimBox = [200 200 100];
|
||||||
|
|
||||||
%% setup FDTD parameter & excitation function
|
%% setup FDTD parameter & excitation function
|
||||||
f0 = 0e9; % center frequency
|
f0 = 2e9; % center frequency
|
||||||
fc = 3e9; % 20 dB corner frequency (in this case 0 Hz - 3e9 Hz)
|
fc = 1e9; % 20 dB corner frequency
|
||||||
FDTD = InitFDTD( 30000, 1e-5 );
|
FDTD = InitFDTD( 30000 );
|
||||||
FDTD = SetGaussExcite( FDTD, f0, fc );
|
FDTD = SetGaussExcite( FDTD, f0, fc );
|
||||||
BC = {'MUR' 'MUR' 'MUR' 'MUR' 'MUR' 'MUR'}; % boundary conditions
|
BC = {'MUR' 'MUR' 'MUR' 'MUR' 'MUR' 'MUR'}; % boundary conditions
|
||||||
FDTD = SetBoundaryCond( FDTD, BC );
|
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
|
P_in = 0.5*U.FD{1}.val .* conj( I.FD{1}.val ); % antenna feed power
|
||||||
|
|
||||||
|
drawnow
|
||||||
|
|
||||||
%% NFFF contour plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%% NFFF contour plots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
%find resonance frequncy from s11
|
%find resonance frequncy from s11
|
||||||
f_res_ind = find(s11==min(s11));
|
f_res_ind = find(s11==min(s11));
|
||||||
|
Loading…
Reference in New Issue
Block a user