Frequency Response Function and Delay
1 回表示 (過去 30 日間)
古いコメントを表示
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.)
0 件のコメント
回答 (1 件)
Bruno Luong
2018 年 11 月 5 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Digital Filtering についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!