
Hi all,
I'm working with electromagnetic materials and trying to reverse-engineer or verify complex permittivity (ε) and permeability (μ) values from S-parameter data (S11, S21). I have a dataset like this for each frequency point:
Here’s a sample of the kind of data I have (per row):
frequency(Hz), Tr1 (ε'), (ε''), Tr2 (ε'), (ε''), Tr3 (ε'), (ε''),
Tr4 (μ'), (μ''), Tr5 (μ'), (μ''), Tr6 S11(Re), (Im), Tr7 S21(Re), (Im)
8.20E+09, 2.32, -0.0456, 2.32, -0.0456, 2.32, -0.0456, 0.832, 0.0824, 0.832, 0.0824, -0.128, -0.310, 0.809, -0.456
And here is the MATLAB code I currently have:
clc; clear;
% Constants
c = 3e8; % Speed of light (m/s)
freq_Hz = 8.20e9; % Frequency (Hz)
d = 0.002; % Sample thickness (m)
omega = 2*pi*freq_Hz;
% Given S-parameters from Keysight
S11 = -0.128 - 1i*0.310;
S21 = 0.809 - 1i*0.456;
% Step 1: Calculate reflection coefficient Gamma
X = (S11.^2 - S21.^2 + 1) ./ (2*S11);
root = sqrt(X.^2 - 1);
Gamma_candidates = [X + root, X - root];
Gamma = Gamma_candidates(abs(Gamma_candidates) < 1);
% Step 2: Calculate e^(-gamma*2d)
e_neg_gamma_2d = S21 ./ (1 - Gamma .* S11);
% Step 3: Phase unwrap for proper branch selection
mag = abs(e_neg_gamma_2d);
phase = unwrap(angle(e_neg_gamma_2d));
e_neg_gamma_2d_unwrapped = mag .* exp(1i*phase);
% Step 4: Calculate gamma (propagation constant)
gamma = -log(e_neg_gamma_2d_unwrapped) / (2*d);
% Step 5: Refractive index n
n = gamma * c / (1i * omega);
% Step 6: Impedance Z
Z = (1 + Gamma) ./ (1 - Gamma);
% Step 7: Relative permeability and permittivity
mu_r = n .* Z;
epsilon_r = n ./ Z;
% Step 8: Display results
fprintf('Results at %.2f GHz:\n', freq_Hz/1e9);
fprintf('Real Permittivity (ε\') : %.6f\n', real(epsilon_r));
fprintf('Imaginary Permittivity (ε\'\') : %.6f\n', -abs(imag(epsilon_r)));
fprintf('Real Permeability (μ\') : %.6f\n', real(mu_r));
fprintf('Imaginary Permeability (μ\'\') : %.6f\n', -abs(imag(mu_r)));
What I’m looking for:
*
A way to *adjust or verify this code so that it gives me ε and μ matching the values in my data* (as shown above).
*
Possibly suggestions on which assumptions or approximations in NRW might need tweaking (e.g., sample thickness, sign convention, root choice, etc.).
*
Bonus: how to handle this across multiple frequencies from Excel.
Any insights or examples would really help. Let me know if you want the full dataset or script I’m using.
Thanks a lot!
Best regards,