matlab: calcMSLPort.m: minor update

pull/1/head
Sebastian Held 2010-10-04 10:16:05 +02:00
parent 007e8c72f3
commit 77d371788d
1 changed files with 30 additions and 15 deletions

View File

@ -1,18 +1,32 @@
function [S11,beta,ZL] = calcMSLPort( portstruct, SimDir, f, ref_shift ) function [S11,beta,ZL] = calcMSLPort( portstruct, SimDir, f, ref_shift )
% [S11,beta,ZL] = calcMSLPort( portstruct, SimDir, [f], [ref_shift] ) %[S11,beta,ZL] = calcMSLPort( portstruct, SimDir, [f], [ref_shift] )
% %
% portstruct: return value of AddMSLPort() % Calculate the reflection coefficient S11, the propagation constant beta
% SimDir: directory, where the simulation files are % of the MSL-port and the characteristic impedance ZL of the MSL-port.
% f: (optional) frequency vector for DFT % The port is to be created by AddMSLPort().
% ref_shift: (optional) reference plane shift measured from start of port (in drawing units)
% %
% reference: W. K. Gwarek, "A Differential Method of Reflection Coefficient Extraction From FDTD Simulations", IEEE Microwave and Guided Wave Letters, Vol. 6, No. 5, May 1996 % input:
% portstruct: return value of AddMSLPort()
% SimDir: directory, where the simulation files are
% f: (optional) frequency vector for DFT
% ref_shift: (optional) reference plane shift measured from start of port (in drawing units)
% %
% output:
% S11: reflection coefficient
% beta: propagation constant
% ZL: characteristic line impedance
%
% reference: W. K. Gwarek, "A Differential Method of Reflection Coefficient Extraction From FDTD Simulations",
% IEEE Microwave and Guided Wave Letters, Vol. 6, No. 5, May 1996
%
% openEMS matlab interface
% -----------------------
% Sebastian Held <sebastian.held@uni-due.de>
% See also AddMSLPort % See also AddMSLPort
% check % check
if portstruct.v_delta(1) ~= portstruct.v_delta(2) if portstruct.v_delta(1) ~= portstruct.v_delta(2)
warning( 'mesh is not equidistant; expect degraded accuracy' ); warning( 'openEMS:calcMSLPort:mesh', 'mesh is not equidistant; expect degraded accuracy' );
end end
% read time domain data % read time domain data
@ -23,14 +37,15 @@ I = ReadUI( {[filename 'A'],[filename 'B']}, SimDir );
if (nargin > 2) && ~isempty(f) if (nargin > 2) && ~isempty(f)
% freq vector given: use DFT % freq vector given: use DFT
for n=1:numel(U.FD) f = reshape( f, 1, [] ); % make it a row vector
U.FD{n}.f = f; for n=1:numel(U.FD)
U.FD{n}.val = DFT_time2freq( U.TD{n}.t, U.TD{n}.val, f ); U.FD{n}.f = f;
end U.FD{n}.val = DFT_time2freq( U.TD{n}.t, U.TD{n}.val, f );
for n=1:numel(I.FD) end
I.FD{n}.f = f; for n=1:numel(I.FD)
I.FD{n}.val = DFT_time2freq( I.TD{n}.t, I.TD{n}.val, f ); I.FD{n}.f = f;
end I.FD{n}.val = DFT_time2freq( I.TD{n}.t, I.TD{n}.val, f );
end
end end
delta_t = I.TD{1}.t(1) - U.TD{1}.t(1); delta_t = I.TD{1}.t(1) - U.TD{1}.t(1);