Calculate Impulse Response of a System From Its Input/Output Waveform via FFT From the theory, I knew something like :

$y(n) = x(n)*h(n)$

$Y(n) = X(n)H(n)$

$H(n) = \frac{Y(n)}{X(n)}$

Now I have $y(n)$ and $x(n)$ from a system, and $y(n)$ is 2176 samples long, $x(n)$ is 2176 samples long.



However, if I used following code to calculate impluse response, it wasn't correct to me, anyone could help figure out where I am wrong ? 

bit = load('C:\Users\wangyang\Desktop\bit_wf.txt')

x = bit(:,2)

subplot(2,1,1)
plot(x)
title('x(n)')

sbr = load('C:\Users\wangyang\Desktop\wf.txt')

y = sbr(:,2)

subplot(2,1,2)
plot(y)
title('y(n)')

X = fft(x)
Y = fft(y)
h = ifft(Y/X)
plot(h) %plot impulse response




If I used ./ instead of / to calucalte the h as folloiwng:

X = fft(x)
Y = fft(y)
h = ifft(Y./X)
plot(h) %plot impulse response


The h looks like as following :



Thanks so much.
It would be best to upload the exact data for $x[n]$ and $y[n]$, but the reason I think of, is that either at least one of your signals is not a perfect baseband signal and has considerable amount of energy everywhere, or (this one is more probable) the signals are baseband but your sampling rate is not high enough, hence the Nyquist criterion is not satisfied and aliasing has occurred. In the latter case, try increasing the number of samples per each signal. Note that this is also an approximate, because the DFT package of MATLAB operates on discrete signals, yet with truncation in both time and frequency.