Forums

questions raised by reading and thinking with possibly missing background

Started by Richard Owlett December 10, 2005
Randy Yates wrote:

> abariska@student.ethz.ch writes: > > > Randy Yates wrote: > > > > ... > >> >> Consider the filter coefficients determined as > >> >> > >> >> function y = test(x) > >> >> %function y = test(x) > >> >> n = [-25 : 25]; > >> >> Fs = 1; > >> >> Ts = 1/Fs; > >> >> t = n*Ts; > >> >> plot(sinc(t+1/7)); > >> >> > >> >> These are neither symmetric nor antisymmetric in the sense you defined, > >> >> and yet this is a linear phase filter, is it not? > >> > > >> > No, it's not. > >> > >> True, but this is: > >> > >> b[n] = sinc(n + 1/7) > > > > Since Fs = Ts = 1, I don't see a difference between sinc(t+1/7) and > > sinc(n+1/7) ? > > There isn't a difference in that respect. The difference is that n is not > constrained to be between -25 and +25.
Ah, you didn't mention that. You claim that the infinitely long sequence b[n] = sinc(n + 1/7), for all n, is linear-phase. That could be true. Do you have an idea for a proof?
abariska@student.ethz.ch writes:
> [...] > You claim that the infinitely long sequence > > b[n] = sinc(n + 1/7), > > for all n, is linear-phase. That could be true. Do you have an idea > for a proof?
Not a complete one, but a possible outline could be this: A digital filter is linear-phase if and only if its continuous-time counterpart (i.e., the continuous-time signal interpolated from the digital sequence) is linear-phase. The interpolation of the given sequence is an offset sinc(), which is linear phase. -- % Randy Yates % "The dreamer, the unwoken fool - %% Fuquay-Varina, NC % in dreams, no pain will kiss the brow..." %%% 919-577-9882 % %%%% <yates@ieee.org> % 'Eldorado Overture', *Eldorado*, ELO http://home.earthlink.net/~yatescr
Randy Yates wrote:

> abariska@student.ethz.ch writes: > > [...] > > You claim that the infinitely long sequence > > > > b[n] = sinc(n + 1/7), > > > > for all n, is linear-phase. That could be true. Do you have an idea > > for a proof? > > Not a complete one, but a possible outline could be this: A digital > filter is linear-phase if and only if its continuous-time counterpart > (i.e., the continuous-time signal interpolated from the digital sequence) > is linear-phase. The interpolation of the given sequence is an offset > sinc(), which is linear phase.
That won't work. For an FIR with real coefficients, the if and only if condition for linear phase response is that the impulse response be symmetric or antisymmetric. This would contradict your statement. I found the correct condition in that link that Peter K posted (http://0xdc.com/paper.pdf): " Theorem: A real, discrete signal x(n) has linear phase response iff x_a(t) := sum_n x(n) sinc( pi (t-n) ) is symmetric about some point d. " That excludes your truncated asymmetrically sampled symmetric continuous signal (because the finite number of asymmetric samples result in an asymmetric reconstructed signal x(t)). Regards, Andor
> Randy Yates wrote: > > > abariska@student.ethz.ch writes: > > > [...] > > > You claim that the infinitely long sequence > > > > > > b[n] = sinc(n + 1/7), > > > > > > for all n, is linear-phase. That could be true. Do you have an idea > > > for a proof? > > > > Not a complete one, but a possible outline could be this: A digital > > filter is linear-phase if and only if its continuous-time counterpart > > (i.e., the continuous-time signal interpolated from the digital sequence) > > is linear-phase. The interpolation of the given sequence is an offset > > sinc(), which is linear phase. > > That won't work.
Rereading your statement, it seems to be exactly the stated theorem, so I retract that. :-) Regards, Andor
I wrote:

> " > Theorem: A real, discrete signal x(n) has linear phase response iff > > x_a(t) := sum_n x(n) sinc( pi (t-n) ) > > is symmetric about some point d. > "
Hmm. What about antisymmetric impulse responses?
Jerry Avins wrote:

> Richard Owlett wrote: > >> Jerry Avins wrote: > > > ... > >>> The the differences between the shapes of filters is subtle. If those >>> filters without steps at the ends, I find it difficult to distinguish >>> a Blackman from Nuttall, Blackman-Harris, von Hann, and others. What >>> distinguishing feature of Blackman attracts you? >> >> >> >> I have a pdf of unknown title ( got saved as Windows.pdf ) written by >> Craig Stuart Sapp <craig@ccrma.stanford.edu> 25 Feb 1997. >> >> I has a collection of various windows and their transforms. The >> particular Blackman window illustrated had a "nice" central lobe and >> all the residual lobes were of "uniform" shape and at least 60 dB down. > > > Those plots are not the shapes of the windows. Rather, they are the > shapes of the frequency responses obtained by applying the windows to a > filter, not at all what you wrote. Better shapes than any of them (but > not by much) are filters optimized by Parks-McClellan and such. Look up > "windowed sinc". > >> *DARN YOU MR. AVINS* >> You just made me read rather than just look at pretty pictures ;{ > > > :-) > >> The plot of the particular Blackman-Harris window had max side lobes >> another 20 dB down, but scale of drawing emphasized the side lobes >> near the central one. >> >> Transform of illustrated Hann window -- too much slop >> Transform of illustrated Hann-Poisson window has a "pleasing shape" >> with less "rejection" off central peak. >> >> I've been "hit over head with 2x4" on another issue. >> What a implications of all these being symmetric about some point. >> Obviously if I'm going to have >> "passband 1 of width a centered at freq b" >> and >> "passband 2 of width y centered at freq z" >> what strange effects will asymmetry have? > > > Try it and see. Won't ScopeDSP do it for you?
Just took a look at those pages. Think I would want full version of both ScopeDSP and ScopeFIR. [my demo expired about a year ago] For now I'll have to use Scilab -- too many hobby projects, too little money
> > ... > > Jerry
"robert bristow-johnson" <rbj@audioimagination.com> wrote in 
news:1134621843.275767.24770@g14g2000cwa.googlegroups.com:

> Al Clark wrote: >> >> I think the main criticism with Linear Phase FIR filters is that you
can
>> often hear pre-echos caused by the fact that the impulse response is >> symmetrical around the center. > > but it's not so much the ripples ramping up to the main lobe of the > impulse response, Al. it's a consequence of using the Parks-McClellan > algorithm to design an "equi-ripple" filter. those ripples in the > pass-band are like multiplying by a cosine which has the effect of > translation in the other domain. > >> Imagine someone hits a drum. You can hear the drum before he hits it. >> If the filters have a fairly regular passband ripple (kind of >> sinusoidal), such as might be expected from a PM filter, then the pre- >> echo will be concentrated. You can reduce this effect, by using a
filter
>> with a more "random" like passband ripple. BTW: (I learned all this
from
>> a discussion with rbj). > > this is what i meant, Al - you can see a picture of it at: > > http://www.circuitcellar.com/library/eq/154/4.htm
This is what I meant as well, I just didn't express it well. The picture at the link illustrates the problem.
> > below, at bottom, is a simple MATLAB program that will compare a LPF > design using Parks-McClellan (otherwize known as "remez" in MATLAB > land), Least Squares, and a Kaiser-windowed sinc methods. if the > design method is Parks-McClellan, it is likely that the ripples *will* > look like a cosine with a pretty constant frequency (and P-McC will > make sure the amplitude is constant) over the passband. this is > equivalent to taking a smoother LPF frequency response and multiplying > it by a small cosine biased up by the constant 1. multiplying in the > frequency-domain is the same as convoluting in the time-domain. > multiplying by the constant 1 is like convolving with a delta function > (which changes nothing) but multiplying by the small cosine is like > convolving by a pair of offset deltas that are small in amplitude. > that means the main LPF impulse will be translated to the edges before > and after the main impulse (a pre-echo and post-echo). temporal > masking might hide the post-echo, but not the pre-echo. > > run the following MATLAB code if you can to see. (you will have to fix > the word-wrapping that Google Groups puts in.) you can visually see > the pre-echo and post-echo that will go away if you use a different > design method. > > r b-j > > % lpf.m > > % Basic Parks-McClellan (or Least Squares or windowed sinc) Low-Pass > Filter Design > > if exist('filename') ~= 1, > filename = 'lpfcoefs.txt'; % filename for FIR coefs output > end; > > % the input parameters are not changed if they already exist > > if exist('SR') ~= 1, > SR = 96; % sampling rate > end; > > if exist('PB') ~= 1, > PB = 20; % top of passband region (where filter should be flat > and 0 dB) > end; > > if exist('PBR') ~= 1, > PBR = 0.5; % max passband ripple in dB which is twice the max > error in passband > end; > > if exist('SB') ~= 1, > % SB = SR/2 - PB; > SB = 20.5; % bottom of stopband region (where filter should be > flat and -inf dB) > end; > > if exist('SBG') ~= 1, > SBG = -84; % max stop band gain in dB > end; > > R = (PB + SB)/SR; > > % Number of required FIR taps, from a formula in Oppenhiem & Schafer > p. 480 > % the more complex and accurate MATLAB function remlpord() could be > used instead. > % for nicety, we always round up to the nearest odd number of FIR > taps. > % when N is odd, the delay (N-1)/2 is always an integer number of > samples > > N = 2*ceil(0.0342416*SR*(-0.5*SBG - 10*log10(10^(0.5*PBR/20)-1) - > 13)/(SB-PB) - 0.5) + 1 > > if 0 % set this to 1 if you wanna get coefficients > for windowed sinc LPF (for testing) > > h = zeros(1, N+1); % zero the whole thang > > t = linspace(-R*(N-1)/2, R*(N-1)/2, N); > h = [0 (R*sinc(t)) .* kaiser(N, 0.1102*(-SBG-8.7))'] ; % > kaiser windowed sinc() > clear t; > > else > > W = ( (10^(0.5*PBR/20) - 1) )/( 10^(SBG/20) ) % linear > stopband/passband weighting ratio > > f = [0 PB/(0.5*SR) SB/(0.5*SR) 1]; % Define passband and > stopband regions > m = [1 1 0 0]; % Define passband and > stopband magnitudes > w = [1 W ]; % Define passband and > stopband error weights > > h = zeros(1, N+1); > > % h = [0 firls(N-1, f, m, w)]; % Compute impulse response from > Least Squares > > h = [0 remez(N-1, f, m, w)]; % Compute impulse response from > Parks-McClellan > > end > > % h(1) = 0 and h((N+1)/2) = max > % symmetry: h((N+1)/2 + k) = h((N+1)/2 - k) > % this should result in zero phase > % in the frequency response. > > plot(h/R, '.'); % plot scaled impulse response pause; > > H = fft([h([(N+1)/2+1:N+1]) zeros(1, 3*(N+1)) h([1:(N+1)/2])]); % > fft after zero-padding to extend length by factor of 4 > > freq = linspace(0, 1-2/(N+1), 2*N+1); % set of frequencies > from DC to just under Nyquist > > plot(freq, 20*log10(abs(H(1:2*N+1))+1.0e-7)); % dB by linear > freq plot > pause; > > axis([0 0.5 -1 1]); % look closely at passband ripple > pause; > > semilogx(freq(2:2*N+1), 20*log10(abs(H(2:2*N+1))+1.0e-7), 'g'); % dB > by log freq plot, skip DC > pause; > > axis([0.05 0.5 -2 2]); > > h = h/R; > > outfile=fopen(filename,'wt+'); > fprintf(outfile, '%1.8e\n', h(2:N+1)); > fclose(outfile); > >
-- Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
abariska@student.ethz.ch wrote:

   ...

> You claim that the infinitely long sequence > > b[n] = sinc(n + 1/7), > > for all n, is linear-phase. That could be true. Do you have an idea for > a proof?
Over all n, sinc(n) is symmetric, hence linear phase. Sinc(n + 7) has a pure delay added to it. Pure delay doesn't upset linear phase. Over the range -18 <= n <= 32, sinc(n +7) is also linear phase. It's symmetry about the center that counts. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
Jerry Avins wrote:

> abariska@student.ethz.ch wrote: > > ... > > > You claim that the infinitely long sequence > > > > b[n] = sinc(n + 1/7), > > > > for all n, is linear-phase. That could be true. Do you have an idea for > > a proof? > > Over all n, sinc(n) is symmetric, hence linear phase. Sinc(n + 7) has a > pure delay added to it. Pure delay doesn't upset linear phase. Over the > range -18 <= n <= 32, sinc(n +7) is also linear phase. It's symmetry > about the center that counts.
But the delay in b[n] is fractional, 1/7 sample, and the resulting windowed and sampled sinc does not have linear phase response. It is interesting that with infinite many samples, strict symmetry of the coeffcients is not needed anymore for linear phase.
abariska@student.ethz.ch wrote:

> > > Since Fs = Ts = 1, I don't see a difference between sinc(t+1/7) and > > > sinc(n+1/7) ? > >
...
> You claim that the infinitely long sequence > > b[n] = sinc(n + 1/7), > > for all n, is linear-phase. That could be true. Do you have an idea for > a proof?
it appears to me that you already have it proved. at least for frequencies between -Nyquist to +Nyquist. since the acausal continuous-time impulse response h(t) = sinc(t - d) has frequency response as H(f) = exp(-j*2*pi*f*d) for |f| < 1/2 , zero otherwize, then H(f) is clearly linear phase for any constant delay, d. and since H(f) is 0 for |f| >= 1/2, h(t) can be sampled at a sampling rate,1/T, of 1 and have no aliasing: h[n] = h(n*T) = sinc(n - d) according to the sampling theorem the frequency response of the sampled function is the same as the frequency response of the continuous-time function getting sampled for frequencies with magnitude less than Nyquist (in this case, Nyquist is 1/2) and that frequency response is periodically extended for frequencies above Nyquist. does that do it for you, Abariska? r b-j