getting frequency response from input and output signal
What you are looking for is probably an empirical transfer-function estimate (ETFE). Several methods can be used, but Welch's averaged periodogram [1] is arguably the most used [2].

The plant output data is usually generated using Gaussian white-noise excitation, although more informative input signals can be generated by experiment design, if prior information about the plant is known [3]. The ETFE of the plant $\widehat{G}(k)$ is found as the quotient of the cross power spectral density estimate of the input and the measured output $P_{yu}(k)$, and the power spectral density estimate of the input $P_{uu}(k)$, i.e.,
\begin{equation*}
 \widehat{G}(k) = \frac{P_{yu}(k)}{P_{uu}(k)} .
\end{equation*}
In Welch's method, the time-series data is divided into windowed segments, with an option to use overlapping segments. Then, a modified periodogram of each segment is computed and the results are averaged. Welch's method for generating an ETFE corresponds to the function tfestimate in MATLAB. One of the advantages of Welch's method is the flexibility in terms of the number of frequency samples and excitation signal used.