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)


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

y = sbr(:,2)


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

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 :

./ impulse response

Thanks so much.

  • $\begingroup$ One way to test your current approach is to plot conv(h, x) over the top of the y that you do have. For a more concrete metric, see what the difference is mean(abs(y - conv(h, x))) $\endgroup$ – Engineer Apr 28 '20 at 11:52
  • $\begingroup$ I failed to do that, I found my h is not a vector, so I can't do conv operation, the size(h) is 2716*2716, I don't know how to extract the proper vector from it for this calculation. $\endgroup$ – WangYang.Cao Apr 28 '20 at 16:24
  • $\begingroup$ In MATLAB, component wise division is ./ not /. Try making that change $\endgroup$ – Engineer Apr 28 '20 at 16:27
  • $\begingroup$ Also, if h is a matrix what are you showing in your last plot? $\endgroup$ – Engineer Apr 28 '20 at 16:27
  • $\begingroup$ I just used the / to get h as showed above, and the last diagram is just result from plot(h) directly, I also updated the plot if I used ./ for reference. $\endgroup$ – WangYang.Cao Apr 28 '20 at 17:09

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.

  • $\begingroup$ Thanks, Ayaz, I am not sure how to attach the file here, they are 2000+ lines for each. They should be perfect baseband signal, and I generated them from a tool called ADS. The sample is 32 samples per UI. And they are 4 period of 0000_1_0000, 32*9 = 544 samples per period, 2176 samples for 4 period in total. $\endgroup$ – WangYang.Cao Apr 27 '20 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.