I have implemented in Matlab (with minor variations) the example 5.1.2 "Illustration of Effects of Group Delay and Attenuation" I found in Alan Oppenheim's Discrete-Time Signal Processing 3rd edition. In this example, 3 narrow band signals (high $0.4*2*\pi$, low $0.1*2*\pi$ and medium $0.2*2*\pi$ frequency in that order) which I will call tones, are supplied as the input to an LTI filter which has both positive and negative group delay. The goal of the example is to trace the effect on the individual tones at the output of the system.
Even though the book doesn't mention explicitly anything about causality in this example, I'm interested in the causal system case. I have modified the original example (see code) to obtain a negative group delay in a broader range of frequencies around $0.4*2*\pi$ and I have switched the input order. The negative group delay is achieved by placing zeros close to the unit circle and around $0.4*2*\pi$. This unfortunately attenuates this frequency at the output.
This is the group delay and pole-zero plot of the system.
From the group delay around $0.4*2*\pi$ one might be tempted to think that since the group delay is a measure delay, then a negative group delay would imply that a signal can exit the system before it enters it, which would contradict causality.
This is the output of the system when the input is medium ($0.2*2*\pi$), low ($0.1*2*\pi$) and high ($0.4*2*\pi$) frequency narrow-band signals in that order:
Would it be correct to think that the tone with high frequency ($0.4*2*\pi$) has been advanced (moved towards time origin) even though due to attenuation we can't see it? Sort of thinking that it has switched places with low frequency ($0.1*2*\pi$). Namely, having a medium, low, high input the output is medium, high, low.
Is this a non-causal system made causal using a buffer since it uses the samples previous to the high tone to be able to shift it there?
If the tone with high frequency is placed first, since it couldn't be moved previous to that position, is it correct to assume that the filter will impose a delay to perform a causal filtering?
- I have seen that for causal systems, an all-pass system contributes with a positive group delay. Is it possible to have a causal stable LTI filter with negative group delay? Is it possible that it doesn't have a close to zero magnitude around this band?
This article based on this post says that negative group delays do not imply time advance for causal systems. Rather, for signals in the band where the group delay is negative the filter tries to predict the input. If the signal is predictable from past values, then this brings about the illusion of a time advance. But this isn't really an answer to question 4.
This is my code:
tiempo = 1:200;
tono1 = hamming(length(tiempo))'.*cos(0.2*pi*tiempo);
tono2 = hamming(length(tiempo))'.*cos(0.4*pi*tiempo - pi/2);
tono3 = hamming(length(tiempo))'.*cos(0.8*pi*tiempo + pi/5);
%original sequence from the example
%secuencia = [tono3 tono1 tono2 zeros(1,2*length(tiempo))] ;
%illustrative sequence
secuencia = [tono2 tono1 tono3 zeros(1,2*length(tiempo))] ;
figure
subplot(2,1,1)
plot(secuencia)
subplot(2,1,2)
plot(linspace(-pi,pi,length(secuencia)),abs(fftshift(fft(secuencia))))
% My modified system
Num = [0.0680369323869657,-0.148751468103317,-0.0840727385654123,0.433116714755249,0.194034734683412,-1.18139470037352,0.0865655483581989,1.87573223477322,-0.293287926967094,-2.71438209027864,0.967801050690298,2.73479750957294,-1.12373673157765,-2.50948341257372,1.33900328885438,1.60284621216217,-0.912031371991086,-0.934571172916517,0.623244740868535,0.316805565059412,-0.216878871699853,-0.101146864726266,0.0801206879869380];
Den = [1,-4.06364506017978,5.66323235132978,0.124350390160437,-7.36267038756774,1.97922786687038,11.0014898216757,-9.54873204176815,-5.37236943566056,9.75531866728175,0.420222506724089,-5.86926610519296,1.27627523253023,2.30928781145590,-1.18242719020123,0.106216188692196,-0.119037174950185,-0.0591088940098283,0.289996632822651,-0.260065787926090,0.248585836431488,-0.184399072803746,0.0647608900392396];
% Hd = dsp.IIRFilter('Numerator', Num, 'Denominator', Den);
% Hd = dfilt.df2t(Num, Den);
resultado = filter(Num,Den,secuencia);
figure
subplot(2,1,1)
plot(resultado)
subplot(2,1,2)
plot(linspace(-pi,pi,length(resultado)),abs(fftshift(fft(resultado))))
sin(x)
is at the input,cos(x)
is at the ouput, which might give the impression it's time-advancing, but if you'd have a pulse, you'd see there is nothing like that. You cannot make a stable filter with only negative time delay (never tried unstable), only "dips", here and there, which have to obey the general filter as being causal. Those dips will behave strangely, but not unnatural. $\endgroup$H(s)=1/(s^2+s+1)
(**-**0.5+/-j0.866); phase isim/re
, withim=-w
andre=1-w^2
.im
is negative,re
is positive untilw0
, then negative. Phase goes negative. Unstable is withs^2-s+1
, whenim
is positive,re
unchanged, thus phase goes positive. $\endgroup$