# Determining the transfer function from discrete signals

I have measurements of a discrete in- and output signals, and I want to find the transfer function of the system. Is there a good method for finding the transfer function of an LTI system from discrete in- and output vectors?

For these synthetic data (see image), the output was generated in Simulink by applying the transfer function: $$\frac{1}{1 + RC s}$$ to the input (it should simulate the response of a simple RC circuit). The goal is to be able to determine the time constant, $$RC$$, from only the in- and output signals.

My idea was to use a z-transform on the in- and output vectors to get the transfer function:

$$H(z) = \frac{Y(z)}{X(z)}$$,

and then find the poles. However, I can't find any implementation of this method.