Frequency Response Function and Delay
이전 댓글 표시
I have two time-series, the input u and the response y (both are raw vectors of the same length). I want to calculate the (Fourier) response function and the delay per frequency. Let Fu and Fy be the Fourier transforms of u and y respectively (e.g. Fx = fft(x)). Then for a linear system the response function R(f) is given by
R(f) = Fy(f)/Fu(f)
and the delay is given by
tau(f) = -arg( R(f) )/(2*pi*f)
since R(f)exp(i*2*pi*f*t) = abs(R(f))exp(i*2*pi*f*t)*exp(i*arg) = exp(i*2*pi*f*(t-tau)).
I tried to implement it in the following code:
%%Fourier analysis and delay per frequency
uM = ... % input
yM = ... % response
fs=1; % sampling frequency
N=length(uM);
% enforce evenness
if mod(N,2)==1
uM1 = uM(1:N-1);
yM1 = yM(1:N-1);
N = N-1;
else
uM1 = uM;
yM1 = yM;
end
% Fast Fourier Transform (symmetric to zero)
Fu = fftshift(fft(uM1));
Fy = fftshift(fft(yM1));
ff = (-N/2:N/2-1)*(fs/N); % zero-centered frequency range
mid = find(ff==0);
if isempty(mid)
mid = 0;
end
% The delay time per frequency = tau(f)
ftau = -unwrap(angle(Fy./Fu))./(2*pi*ff); % delay per freq = tau_w
figure
plot(ff((mid+1):end),ftau((mid+1):end))
xlabel('\fontsize{14} Frequency: f [Hz]')
ylabel('\fontsize{14} Delay per freq: \tau [sec]')
title('\fontsize{14} STRSF14')
grid on
I attach the data and the plots obtained by this code.
Example 1:

However, this results seems wrong, since for a causal linear system the delay time should be non-negative.
Example 2:
The signal in time:

The delay (via the response function):

However, this results seems wrong, since for a causal linear system the delay time should be non-negative. There is a point with a jump of about -5.6818 pi, which also seems odd.
Where am I wrong?
(P.S. I don't have the signal processing toolbox.)
답변 (1개)
Bruno Luong
2018년 11월 5일
0 개 추천
When you compute the phase there is always an arbitrary shift of (k*2*pi), k integer.
I think a reasonable assumption is make your unwrap phase = 0 for ff = 0, that will probably resolve the negative phase-shift.
댓글 수: 5
Bruno Luong
2018년 11월 5일
Your signals is not periodic, thus estimate the phase using FFT is dangerous, you might apply some window function before doing analysis.
Bruno Luong
2018년 11월 6일
Evenor
2018년 11월 6일
카테고리
도움말 센터 및 File Exchange에서 Digital Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

