View Raw SPL
/*****************************************************************************
* *
* CHEBWIN.SPL Copyright (C) 2012 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Multiplies a series with a Dolph-Chebyshev window *
* *
* Revisions: 6 Jan 2012 RRR Creation *
* *
*****************************************************************************/
#if @HELP_CHEBWIN
CHEBWIN
Purpose: Multiplies a series with a Dolph-Chebyshev window.
Syntax: CHEBWIN(s, ampflag, attn)
s - A series, the input series.
ampflag - Optional, an integer, the correction factor.
0: do not correct amplitude (default)
1: correct amplitude
2: correct RMS
3: correct mean squared amplitude
attn - Optional. A real, the sidelobe attenuation
in dB from the mainlobe. Defaults to -100.
Returns: A series.
Example:
W1: gsin(1000, 0.001, 45)
W2: chebwin(w1)
W1 contains a 1000 point sinewave with a frequency of 45 Hz.
W2 multiplies the sinewave with a Dolph-Chebyshev window.
Example:
W1: gsin(1000, 0.001, 45)
W2: chebwin(w1, 0, -65)
Same as the first example except the sidelobe attenuation
is -65 dB.
Example:
W1: chebwin(100, 0, -60)
W2: magspec(w1, 8192);20*log10(curr/max(curr));
W1 Creates a 100 point Dolph-Chebyshev window where the
sidelobe attenuation is -60 dB. W2 displays the normalized
frequency response.
Remarks:
The frequency response of an Nth order Dolph-Chebyshev
window with an attenuation of attn decibels is given by:
W(k) = Cheb(N-1, beta * cos(pi * k / (N-1))) / Cheb(N-1, beta)
where:
Cheb(m, x) is the mth order Chebyshev polynomial and
beta = cosh(acosh(10 ^ (attn / 20)) / (N-1))
The time domain response is determined by computing the
inverse Fourier transform and scaling the result to a
unitary maximum.
The Dolph-Chebyshev windows minimizes the Chebyshev norm of
the sidelobes for a given mainlobe width.
The Dolph-Chebyshev window can be regarded as the impulse
response of an optimal Chebyshev lowpass filter having a
zero-width passband.
Because the Dolph-Chebyshev window yields equiripple constant
magnitude sidelobes, impulses may result at the end points of
the time domain response.
Use GCHEBWIN to generate an N point Dolph-Chebyshev window.
gchebwin(100, 1/100, -60)
creates a 100 point Dolph-Chebyshev window with a sample rate
of 0.01 and an attenuation of -60 dB.
See Also:
FFT
GHAMMIMG
GHANNING
GKAISER
GCHEBWIN
GTAYLORWIN
PSD
SPECTRUM
#endif
/* multiply a series with a Dolph-Chebyshev window */
SERIES ITERATE chebwin(s, ampflag, attn)
{
if (argc < 3)
{
if (argc < 2)
{
if (argc < 1) error("chebwin - input required");
ampflag = 0;
}
attn = -100;
}
return(winfunc(7, s, ampflag, attn));
}