1

I have measured time signals of input (pink noise) and output of a system. I need to calculate TF of a system and it's impulse response.

In order to calculate TF I can do in Matlab directly TF = tfestimate(in, out) or compute fft of both then do TF = fft(out)./fft(in). At this point everything is clear and expected for me, but then when I calculate Impulse response of the system by doing ifft(fft(out)./fft(in)) I get impulse response which has a tail at the end. I was thinking maybe something wrong with my measurements and decided to repeat experiment in matlab synthesizing exponential chirp and passing it trough a filter with following impulse response calculation. Then I get the "same" tale at the end: Impulse response with a "tail" at the end

Please see the code below

t = 0:1/48000:10;
fo = 1;
f1 = 24000;
x = chirp(t,fo,10,f1,'logarithmic');
x = x(:);
y = lowpass(x,1000,48000);
y = y(:);

% playing with FFT length here
% nfft=length(x)*2-1;
% nfft = 4*1024;
nfft=length(x);

tf = tfestimate(x, y,  hann(nfft), nfft/2, nfft, 48000); 
if mod(length(tf),2)==0 % iseven
    tf_sym = conj(tf(end:-1:2));
else
    tf_sym = conj(tf(end-1:-1:2));
end

ir_from_tfestimate = ifft([tf; tf_sym]);

in = fft(x, nfft);
out = fft(y, nfft);
tf1 = out./in;
ir_from_fft = ifft(tf1);

figure
stem(ir_from_tfestimate)
hold on
stem(ir_from_fft)
set(gca, 'XScale', 'log')
  1. So I am wondering what is the nature of this tale? Maybe there is a mistake in my code? I was google and looking for this problem/explanation, but did not find anything

  2. Can it be related how I define nfft and what is the right choice for number of points? Can we say if nfft is defined not correctly, impulse response will not be correct?

  3. When I am trying to recover symmetric part of a spectrum obtained from tfestimate, am I doing it correctly: ?

if mod(length(tf),2)==0 % iseven
tf_sym = conj(tf(end:-1:2));
else; tf_sym = conj(tf(end-1:-1:2));end

Thank you!

acstc
  • 11
  • 1
  • 2
    I haven't looked at your code, and I couldn't run it with my Maltab version; but the "tail" is most likely caused by the fact that the DFT (FFT) implicitly assumes _periodic_ signals. So that tail on the right-hand side is probably the beginning of the impulse response. Imagine horizontally concatenating two copies of the graphs you obtain, and keeping the central part – Luis Mendo Jan 11 '21 at 15:29
  • Hi Luis, thanks for your comment, I was using periodic signal (sin with 2 freqs) instead of chirp, and still can see this tail. I did what you suggested: flip this tail and compared with beginning of Impulse response, and you were right, the shape is the same, but amplitude a bit different. Changing the filter at y (to high-pass) changes the tale, but it still there. I am still wondering and confused why in case of periodic signals this tail is there and what is nature of it? I've never heard/seen about this neither from my uni lectures or any books. I appreciate more deep explanations. – acstc Jan 12 '21 at 15:41

0 Answers0