# Computing Chebyshev Window Sequences

January 8, 20089 comments

Chebyshev windows (also called Dolph-Chebyshev, or Tchebyschev windows), have several useful properties. Those windows, unlike the fixed Hanning, Hamming, or Blackman window functions, have adjustable sidelobe levels. For a given user-defined sidelobe level and window sequence length, Chebyshev windows yield the most narrow mainlobe compared to any fixed window functions.

However, for some reason, detailed descriptions of how to compute Chebyshev window sequences are not readily available in the standard DSP textbooks, and I'm not rightly sure why that is. In any case, here are the steps for one method of computing M-sample symmetrical Chebyshev window sequences:

1. If the desired Chebyshev window sequence length is M, then define integer N = M-1.

2. Define the window's sidelobe-level control parameter as γ.The window's sidelobe levels, relative to the mainlobe peak, will be -20g dB. (Thus, for example, if we desire frequency-domain maximum sidelobe levels of 60 dB below the mainlobe's peak magnitude then we set γ = 3.)

3. Compute parameter α as

α = cosh[cosh-1(10γ)/N].

4. Compute the N-length sequence A(m) using

A(m) = |α•cos(πm/N)|

where the index m is 0 ≤ m ≤ (N-1).

5. For each m, evaluate the Nth-degree Chebyshev polynomial whose argument is A(m) to generate a frequency-domain sequence W(m). There are many ways to evaluate Chebyshev polynomials. Due to its simplicity of notation, I suggest the following:

W(m) = (-1)m•cosh{N•cosh-1[A(m)]}, when |A(m)| > 1,

or

W(m) = (-1)m•cos{N•cos-1[A(m)]}, when |A(m)| ≤ 1.

The W(m) sequence is real-only, although our software's computational numerical errors may produce a complex-valued W(m) with very small imaginary parts. Those imaginary parts, if they exist, should be ignored. The above (-1)m factors are necessary because the frequency-domain index m is never less than zero.

6. Compute a preliminary time-domain window sequence, w(m), using

w(m) = real part of the N-point inverse DFT of W(m).

7. Replace w(0), the first w(m) time sample, with w(0)/2.

8. Append that new w(0) sample value to the end of the N-point w(m) sequence, w(M-1) = w(0), creating the desired M-length window sequence w(k) where time index k is 0 ≤ k ≤ (M-1).

9. Normalize the amplitude of w(k), to obtain a unity peak amplitude, by dividing each sample of w(k) from Step 8 by the maximum sample value in w(k).

The above procedure seems a bit involved but it's not really so bad, as the following Chebyshev window design example will show. Assume we need a 9-sample Chebyshev window function whose frequency-domain sidelobes are -60 dB below the window's mainlobe level. Given those requirements; M = 9, N = 8, γ = 3, and

a = cosh[cosh-1(103)/8] = 1.4863.

After the inverse DFT operation in the above Step 6, w(m=0)/2 = 11.91, thus we set w(k=0) = w(k=8) = 11.91. The maximum value of w(k) is 229.6323, so we divide w(k) by that value yielding our final normalized 9-sample Chebyshev window sequence listed in the rightmost column of Table 1.

Table 1 Nine-point Chebyshev window computations

 m A(m) W(m) w(m) k w(k) w(k) norm. 0 1.4863 1000.00 23.8214 0 11.910 0.0519 1 1.3732 -411.49 52.1550 1 52.1550 0.2271 2 1.0510 6.41 123.5232 2 123.5232 0.5379 3 0.5688 -0.13 197.5950 3 197.5950 0.8605 4 0.0000 1.00 229.6323 4 229.6323 1.0000 5 -0.5688 -0.13 197.5950 5 197.5950 0.8605 6 -1.0510 6.41 123.5232 6 123.5232 0.5379 7 -1.3732 -411.49 52.1550 7 52.1550 0.2271 8 11.910 0.0519

Acknowledgement: I thank DSP guru fredric j. harris (San Diego State Univ.) for his generous personal guidance in helping me create this procedure.

Further Reading: I ran across an interesting website that discusses evaluating Chebyshev polynomials, and computing Chebyshev window sequences in conjunction with designing FIR filters. That website is the paper: "Notes of the Design of Optimal FIR Filters" by John R. Treichler at: http://www.appsig.com/products/tn070.htm

2011 Update: Due to the terrific comments generated by my original blog in January 2008, later that year I added the absolute-value modulus bars (|) in Step 4 for people using inverse hyperbolic cosine software that does not accommodate complex arguments. That change, however, requires us to make another change. If you use the absolute-value bars in Step 4, and M is an even number, then change the sign of the last M/2-1 W(m) samples from Step 5. For example, if M = 32 then Step 5's W(m) has 31 samples and the last 15 of those 31 samples should be negated before preceeding to Step 6.

Previous post by Rick Lyons:
Spectral Flipping Around Signal Center Frequency
Next post by Rick Lyons:
A Simple Complex Down-conversion Scheme

[ - ]
Comment by January 8, 2008 Hi Rick, I used your method to generate a 128 point window and compared it with a Blackman, both having -60dB side lobes. Your design has a main lobe that is about 10% narrower than the Blackman, showing that the method does work as advertised. I give it a thumbs up! Two minor comments. First, I think the equations in step 5 should have A(m) replaced with abs[A(m)]. Second, when the 128 point Chebyshev window is graphed it looks very much like a Blackman. However, the two end points (which are manipulated in steps 7 and 8) do not seem to line up with the other points; their amplitude seems several times too high. Nevertheless, your method is correct, and these funny endpoints are important to the performance of the window. Thanks for the interesting method- Good work! Regards, Steve Smith
[ - ]
Comment by January 11, 2008 Hi Steve, Nice to hear from you. A "thumbs up" from you means much more to me than "two thumbs up" from Siskel and Ebert! Using abs[A(m)] in Step 5 gives me the same results as using A(m). Neither of my two written sources of "Chebyshev window" information mention using absolute values for A(m) in Step 5, so I'm not sure what to say. (I'll confess, I haven't done any thorough searching on the Internet for Chebyshev polynomial information.) In any case, I'm now wondering if using A(m) or abs[A(m)] is the "best thing to do". My (homebrew) MATLAB software restricts my Chebyshev windows to be an odd number of coefficients. When I set M = 127, and sidelobes levels to be -60 dB, my first and last Chebyshev window samples are 0.038 in value. (That's when the window's center sample is unity.) I wonder, what's the value of the first and last samples of a 127-sample window sequence according to your modeling? (By the way, as far as I can tell, the procedure in my blog gives identical results to MATLAB's "chebwin()" function.) Steve, I recall years ago reading something from DSP guru fred harris (I don't remember when or where) when he was discussing the Parks-McClellan ("Remez", "equiripple") method of designing FIR filter coefficients. harris said something like, "For sharp-transition filters, the filter's first and last coefficients will be unexpectedly large values. This is a consequence of having stopband ripples in the frequency domain that are all the same height (equiripple)." Or something like that. So when I saw the first and last samples of a narrow-mainlobe Chebyshev window being large values, that didn't alarm me because Chebyshev windows have stopband ripples in the frequency domain that are all the same height (equiripple). If I recall harris' written words properly, then harris warned us about those large first and last Chebyshev window sample values that don't "line up with their neighbors". My understanding of all of this is not so great. Maybe one of the DSP experts here can straighten me out. Regards, [-Rick Lyons-]
[ - ]
Comment by January 13, 2008 Hi Rick, I think I see what's going on. I did the calculations in Excel, which doesn't support complex numbers. So taking the ACOSH of a negative value causes the program to crash. It appears that if your calculations support complex numbers you don't need the absolute value. However, if you include the absolute value you don't need to use complex numbers. Also, here are the first four numbers in the 128 point window. Same unusual endpoint as you calculated (0.038); but it works great! 0.03846 0.01732 0.02112 0.02542 Regards, Steve
[ - ]
Comment by January 23, 2008 Hi Guys If the Chebyshev window has equiripple behaviour in frequency domain (and the ripple alternates with every sample), then there is a simple reason for the endpoint peaks (I learned this from r b-j on comp.dsp). Imagine the flat frequency response (with no ripples) is multiplied with a cosine to generate the ripples. In time domain, this means convolution of the ideal filter impulse response with two symmetric deltas (time domain of the ripple-cosine). If the frequency of the ripple is maximal (alternating every sample), then the deltas will be situated right at both ends of the impulse response. So, the little peaks at the sides in the time domain are in fact copies of the main impulse response (because convolution with a delta produces a copy of the signal), weighted with the amplitude of the ripple in the frequency domain. Regards, Andor
[ - ]
Comment by February 24, 2008 Hi Rick, I was using matlab to compare the Chebyshev window with Blackman-Harris and I noticed that Blackman-Harris has narrower main lobe and lower side lobe as well. May I know what is your comment for this? Thanks a lot.
[ - ]
Comment by February 24, 2008 Hi boon chun, The following is based on info from:  fredric j. harris, "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform", Proceedings of the IEEE, Vol. 66, No. 1, January 1978. If I use the coefficients a0 = 0.35875, a1 = 0.48829, a2 = 0.14128, a3 = 0.01168, for the 4-Term (-92 dB) Blackman-harris window from page 65 of , and plug them into Eq. (33) on page 64 of , I can compute the coefficients of a 4-term Blackman-harris window sequence. As far as I can tell, the FFT (magnitude) of those Blackman-harris coefficients seem to have a wider mainlobe than the mainlobe of a Chebyshev window having sidelobes levels at -92 dB relative to the mainlobe. Below is the MATLAB code that I used. boon chun, if I have made an error, please let me know. Thanks. [-Rick-] --------- clear Npts = 128; % Number of window coefficients FFTsize = 2048; Cheb = chebwin(Npts,92)'; % Compute Blackman-harris coeffs using Eq. (33) on % page 64, and the 4-Term (-92 dB) coeffs from page 65, % of harris' "Windows" paper. n = 0:Npts-1; BlackHar = 0.35875 - 0.48829*cos(2*pi*n/Npts) ... + 0.14128*cos(2*2*pi*n/Npts) - 0.01168*cos(3*2*pi*n/Npts); BlackHarMag = abs(fft(BlackHar,FFTsize)); BlackHar_dB = 20*log10(BlackHarMag/max(BlackHarMag)); ChebMag = abs(fft(Cheb,FFTsize)); Cheb_dB = 20*log10(ChebMag/max(ChebMag)); figure(1) plot(BlackHar,'-ko') hold on plot(Cheb,':rs') hold off title('Cheb = red, Blackman-harris=black') grid on, zoom on figure(2) plot(BlackHar_dB,'-k') hold on plot(Cheb_dB,'-r','markersize',2) hold off title('Cheb = red, Blackman-harris=black') grid on, zoom on axis([0, FFTsize/16, -110, 0])
[ - ]
Comment by February 25, 2008 Hi Rick, Thanks for your reply and the code. I do agree with you that the Blackman-harris coefficients seem to have a wider mainlobe than the mainlobe of a Chebyshev window with small number of coefficient. But when I increase the number of coefficients said 2048. The situation is different, where Blackman-harris tends to have narrower main lobe than Chebyshev. The reason I used 2048 is because if in a situation where I capture a signal with data size of 2048 points then the window coefficient will need to change to 2048 as well. May I know did I make a wrong judgement here or I have misunderstanding the concept? Please correct me if i did. Thanks a lot. regards, Boon Chun
[ - ]
Comment by February 25, 2008 Hi Rick, I think the math should be based on absolute value of A. Then I could validate the results Sastry
[ - ]
Comment by February 25, 2008 Sorry. As I read my comment again, it sounded kind of incomplete. What I meant was, I implemented it in LabVIEW and was looking at the results of W(m), w(k) etc. I could see discontinuities at indices 5 and 6 (I was running for window length of 9). When I changed from A(m) to abs(A(m)) to be used, then I could get the sane result as you have shown. I have not understood the sharp discontinuity at the end yet. I was wondering why it is so sharp as the length increases. In other words, it would be interesting to know its correslation with the length of the window.

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.

Registering will allow you to participate to the forums on ALL the related sites and give you access to all pdf downloads.