I wrote this simple matlab code to calculate input impedance of a low pass filter but not sure whether all the steps are correct. * First attempt
z0 = 50;
A = importdata("sparameters_lowpass.dat");
freq = A(:,1);
realPart = A(:,2);
imagPart = A(:,3);
s11_freq = realPart + imagPart*i; % In frequency domain
%X = fft(s11_freq, N); % Not sure whether this is the right way to interpolate
X = s11_freq;
X_conj = conj(flip(X));
X_input = [X_conj(1:end-1)', X(1), X(2:end)']';
M = length(X_input);
window = hamming(M);
s11_time = ifft(X_input.*window, 1024);
z_in = z0*(1+ (s11_time))./(1- (s11_time));