# how to convert s-parameters in frequency domain to time domain?

How to convert s-parameters in Matlab's frequency domain to the time domain with code example?

$$S_{21}$$ is the complex transfer function from input (port 1) to output (port 2), typically presented as magnitude and phase. This is the complex frequency response for a device under test. There are other S parameters such as the $$S_{11}$$ as the complex reflection coefficient.
The inverse Fourier Transform of the $$S_{21}$$ frequency response of a two-port linear system is the time domain impulse response for that system. To implement in Matlab, express the frequency response as a complex array and then take the inverse Fourier Transform using the ifft command. Zero pad to minimize time domain aliasing effects. This can be accomplished by specifying the optional length parameter for the ifft function that exceeds the length of the frequency domain array. The result of the zero padding will be to interpolate more samples in the time domain (increasing the sampling rate of the time domain result).