# Impulse response $h[n]$ from input and output signal using cross correlation on Matlab

I have two signals on Matlab, one being input and the other output. I want to know if taking the cross correlation of these signals would give me the impulse response?And if so, will taking the Fourier transform of that resulting signal give me the frequency response?

i want to know if taking the cross correlation of these signals would give me the impulse response?

No.

Let's look at it in the frequency domain. Let's call the input $$x$$, the output $$y$$ and the impulse response $$h$$. Uppercase letters are spectra, lower case time domain signals.

For the transfer function we simply have $$Y = H\cdot X, H = Y/X$$. The spectra of the autocorrelation $$r_{xy} = y \star x$$ is

$$R_{xy} = X' \cdot Y = X' \cdot H \cdot X = H \cdot |X|^2$$

So you will only the get transfer function if the magnitude of the spectrum of the input signal is $$1$$ at all frequencies.

If you do time discrete auto correlation you also have to properly manage circular versus linear auto-correlation .

and if so, will taking the Fourier transform of that resulting signal give me the frequency response?

The transfer function is indeed the Fourier transform of the impulse response but since the cross correlation is NOT the impulse response, you won't be getting the transfer function either.

• thank you for your reply! is there any other way to get impulse response from cross correlation? for discrete time, that is. – user13024886 Dec 10 '20 at 15:51
• and for the Rxy equation, the input signal is the impulse signal, so the magnitude of it would be one? – user13024886 Dec 10 '20 at 15:57
• You can certainly choose the input to be a unit impulse. In this case your output already IS the impulse response (as the name implies) so there is no need to cross correlate anything. In practice that doesn't work well with real physical signals since the unit impulse has very little energy and the signal to noise ratio tends to be poor – Hilmar Dec 10 '20 at 16:35
• that makes sense. thank you for our answer again. Do you recommend any other method to get impulse response using cross correlation? – user13024886 Dec 10 '20 at 17:01
• Why do you want to use cross correlation? It's not the best tool for this sort of thing – Hilmar Dec 10 '20 at 23:12