matlab: port calculation: pass through unknown arguments to ReadUI

Signed-off-by: Thorsten Liebig <thorsten.liebig@gmx.de>
pull/1/head
Thorsten Liebig 2012-12-09 22:06:48 +01:00
parent 1069424914
commit 549949e427
2 changed files with 25 additions and 19 deletions

View File

@ -42,29 +42,33 @@ end
%% read optional arguments %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
n_conv_arg = 3; % number of conventional arguments
%set defaults
ref_ZL = port.Feed_R;
if (nargin>n_conv_arg)
for n=1:2:(nargin-n_conv_arg)
UI_args = {};
for n=1:2:numel(varargin)
if (strcmp(varargin{n},'RefImpedance')==1);
ref_ZL = varargin{n+1};
end
else
UI_args(end+1) = varargin(n);
UI_args(end+1) = varargin(n+1);
end
end
% read time domain data
filename = ['port_ut' num2str(port.nr)];
U = ReadUI(filename, SimDir, f );
U = ReadUI(filename, SimDir, f, UI_args{:} );
filename = ['port_it' num2str(port.nr)];
I = ReadUI(filename, SimDir, f );
I = ReadUI(filename, SimDir, f, UI_args{:} );
% store the original frequency domain waveforms
u_f = U.FD{1}.val;
i_f = I.FD{1}.val; % shift to same position as v
port.Zin = u_f./i_f;
port.f = f;
uf_inc = 0.5 * ( u_f + i_f .* ref_ZL );
if_inc = 0.5 * ( i_f + u_f ./ ref_ZL );

View File

@ -57,27 +57,29 @@ end
%% read optional arguments %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
n_conv_arg = 3; % number of conventional arguments
%set defaults
ref_ZL = -1;
ref_shift = nan;
if (nargin>n_conv_arg)
for n=1:2:(nargin-n_conv_arg)
UI_args = {};
for n=1:2:numel(varargin)
if (strcmp(varargin{n},'RefPlaneShift')==1);
ref_shift = varargin{n+1};
end
if (strcmp(varargin{n},'RefImpedance')==1);
elseif (strcmp(varargin{n},'RefImpedance')==1);
ref_ZL = varargin{n+1};
end
else
UI_args(end+1) = varargin(n);
UI_args(end+1) = varargin(n+1);
end
end
% read time domain data
filename = ['port_ut' num2str(port.nr)];
U = ReadUI( {[filename 'A'],[filename 'B'],[filename 'C']}, SimDir, f );
U = ReadUI( {[filename 'A'],[filename 'B'],[filename 'C']}, SimDir, f, UI_args{:} );
filename = ['port_it' num2str(port.nr)];
I = ReadUI( {[filename 'A'],[filename 'B']}, SimDir, f );
I = ReadUI( {[filename 'A'],[filename 'B']}, SimDir, f, UI_args{:} );
% store the original frequency domain waveforms
u_f = U.FD{2}.val;