Pablo_UDEC
Newbie level 6

Hi everyone, I need some support regarding the Nicolson-Ross-Weir (NRW) characterization method.
My current methodology involves exporting S-parameter data from HFSS (with the “Normalize” option enabled). The simulation is performed using a rectangular waveguide, and I test a material with relative permittivity εᵣ = 9 and relative permeability μᵣ = 1. For verification purposes, both sections (air and test material) have the same physical length.
I would like to ask:
– Is there a more appropriate or optimized simulation setup for implementing the NRW method in HFSS?
– Additionally, is it strictly necessary to use two ports (Tx/Rx), or is there an alternative configuration that also works?
Below is my current MATLAB implementation:
I would appreciate any feedback on the code,thanks!
My current methodology involves exporting S-parameter data from HFSS (with the “Normalize” option enabled). The simulation is performed using a rectangular waveguide, and I test a material with relative permittivity εᵣ = 9 and relative permeability μᵣ = 1. For verification purposes, both sections (air and test material) have the same physical length.
I would like to ask:
– Is there a more appropriate or optimized simulation setup for implementing the NRW method in HFSS?
– Additionally, is it strictly necessary to use two ports (Tx/Rx), or is there an alternative configuration that also works?
Below is my current MATLAB implementation:
Code:
filename_list = dir ('*.s2p')
filePathPath = 'C:\ ROUTE ';
for i=1:length(filename_list)
fileNameWithPath = [ filePathPath '\' filename_list(i).name()];
sParam = sparameters(fileNameWithPath);
freqGHz = sParam.Frequencies/1e9;
s11 = (squeeze(sParam.Parameters(1,1,:))); %1001x1
s21 = (squeeze(sParam.Parameters(2,1,:)));
indx = 1:1:length(freqGHz); % tamaño : 150 en 1 hasta largo de 1001 - x
s11 = real(s11(indx,:)) +1j.*imag(s11(indx,:));
s21 = real(s21(indx,:)) +1j.*imag(s21(indx,:));
figure(1)
plot(freqGHz(indx,:), s21);hold on; plot(freqGHz(indx,:),s11)
variables
%%%%%%%%%%%%%%
a; c0; f0; l0; lg; L; lamdac;
%%%%%%%%%%%%%%
Ref1 = K - sqrt(K.^2 - 1);
Ref2 = K + sqrt(K.^2 - 1);
% Inicializa el vector de salida
Ref = zeros(size(Ref1));
% Máscara lógica donde |Ref1| <= 1
mask = abs(Ref1) <= 1;
% Asigna los valores correspondientes según la condición
Ref(mask) = Ref1(mask);
Ref(~mask) = Ref2(~mask);
% Utiliza s21 en el cálculo de T
T = (s11 + s21 - Ref) ./ (1 - (s11 + s21) .* Ref);
% Obtener el ángulo de fase de t
t_phaser = angle(T); % t debe ser un vector complejo
t_phase_unwrap = t_phaser;
nan_mask = ~isnan(t_phaser); % Máscara lógica para valores válidos
t_phase_unwrap(nan_mask) = unwrap(t_phaser(nan_mask));
% Calculate ln(1/T) with correct phases
ln_1_T = 1j*t_phase_unwrap;
ln_1_T = log(1./abs(T))
% Also create new unwrapped T vector
new_t = 1j*t_phase_unwrap;
new_t = abs(T)
ultaA = sqrt(-(ln_1_T ./ (2*pi*L)).^2 );
ultaA_inv = 1./ultaA;
l0g = 1 / sqrt( 1/lamda0^2 - 1/lamdac^2 );
% Calcular permeabilidad relativa mu_r
mu_r = (1 + Ref) ./ ((ultaA_inv .* (1 - Ref)) .* sqrt((1 ./ lamda0.^2) - (1 ./ lamdac.^2)));
mu_eff = mu_r;
% Calcular permitividad relativa ep_r
Er = (mu_r .* ((1 - Ref).^2 ./ (1 + Ref).^2) .* (1 - (lamda0.^2 ./ lamdac.^2))) +((lamda0.^2 ./ lamdac.^2) .* (1 ./ mu_r));
I would appreciate any feedback on the code,thanks!
Last edited by a moderator: