
Citation 
 Permanent Link:
 http://digital.auraria.edu/AA00002104/00001
Material Information
 Title:
 Band limited window functions used in digital filter design
 Creator:
 Tran, Ha Thi Ngoc
 Place of Publication:
 Denver, CO
 Publisher:
 University of Colorado Denver
 Publication Date:
 1988
 Language:
 English
 Physical Description:
 83 leaves : illustrations ; 28 cm
Thesis/Dissertation Information
 Degree:
 Master's ( Master of Science)
 Degree Grantor:
 University of Colorado Denver
 Degree Divisions:
 Department of Electrical Engineering, CU Denver
 Degree Disciplines:
 Electrical engineering
Subjects
 Subjects / Keywords:
 Digital filters (Mathematics) ( lcsh )
Digital filters (Mathematics) ( fast )
 Genre:
 bibliography ( marcgt )
theses ( marcgt ) nonfiction ( marcgt )
Notes
 Bibliography:
 Includes bibliographical references (leaf 54).
 Thesis:
 Submitted in partial fulfillment of the requirements for the degree, Master of Science, Department of Electrical Engineering, Department of Computer Science and Engineering
 Statement of Responsibility:
 by Ha Thi Ngoc Tran.
Record Information
 Source Institution:
 University of Colorado Denver
 Holding Location:
 Auraria Library
 Rights Management:
 All applicable rights reserved by the source institution and holding location.
 Resource Identifier:
 20858288 ( OCLC )
ocm20858288
 Classification:
 LD1190.E54 1988m .T72 ( lcc )

Full Text 
BAND LIMITED WINDOW FUNCTIONS
USED IN DIGITAL FILTER DESIGN
BY
HA THINGOC TRAN
B.S., UNIVERSITY OF COLORADO, 1986
A thesis submitted to the
Faculty of the Graduate School of the
University of Colorado at Denver in partial fulfillment
of the requirements for the degree of
Masters of Science
Department of Electrical Engineering and Computer Science 1988
II
This thesis is for the Masters of Science degree by
Ha Thi Ngoc Tran
has been approved for the
Department of
Electrical Engineering and Computer Science
by
Date ^
! :'i f 3
L 
Tran, HaThi Ngoc (M.S., Electrical Engineering)
Band Limited Window Functions Used in Digital Filter Design
Thesis directed by Professor Douglas A. Ross
In digital filter design, non band limited window functions have
been used. To add more alternatives to the field, band limited windows are
studied in this thesis. Several graphs will describe the characteristics of
band limited and non band limited window functions. A program was
written to calculate the passband ripple, stopband attennuation and
transition region of a prototype low pass filter response with any window
function used. The program also plots passband ripple, stopband
attenuation and transition region versus the number of coefficients, or versus
the bandwidth of the window. Thus, with this program, any window used in
the prototype low pass filter can be running on any personal computer.
To my parents and brothers, and specially to my husband, Minh Tran, for his
support, understanding and being a dear friend.
V
ACKNOWLEDGEMENT
Appreciation and thanks are extended to Douglas A. Ross,
Committee Chairperson, John Clark and Arun Majumdar for serving on the
committee.
CONTENTS
TABLES................................................... VIII
FIGURES.................................................. Villi
CHAPTER
I. INTRODUCTION.......................................... 1
II. CLASSIFICATION OF WINDOW FUNCTIONS................... 4
Truncation Error and Aliasing....................... 4
Uncertainty Relation................................ 7
The continuous Function........................... 7
Sampled Data...................................... 12
Constructing Band Limited Window Functions.......... 16
Classification of Windows........................... 17
III. FREQUENCY RESPONSE AND WINDOW
CHARACTERISTICS......................................... 24
Frequency Response of Digital Filters................... 24
The Construction of the Program......................... 28
Nvaried Subroutine.................................. 28
Bvaried Subroutine.................................. 29
Window Characteristics.................................. 34
Advantages and Disadvantages............................ 47
Non Band Limited Windows.......................... 47
Band Limited Windows................................. 47
VII
IV. DISCUSSION AND CONCLUSIONS....................... 51
BIBLIOGRAPHY......................................... 54
APPENDIX
A. Program listing of NB varying................... 55
B. Program listing of Uncertainty.................. 75
FIGURES
Figure
2.1 The resolvable and non resolvable spectrum line........... 5
2.2 Aliasing and truncation error.............................. 7
3.1 Prototype lowpass filter spectrum............................. 26
3.2 The amplitude response of a lowpass filter with
a rectangular window used..................................... 27
3.3 Magnitude response with frequency ranges shown............. 30
3.4 The magnitude response of the filter decreases
monotonically in the stopband................................. 33
3.5 Ripple and transition region versus coefficients N of
the filter response with triangular window used............ 34
3.6 Window spectrum of Nonband limited and band limited.... 35
3.7 Ripple and transition region of Von Hann versus N.......... 37
3.8 Ripple and transition region of Hamming versus N........... 37
3.9 Ripple and transition region of Rectangular versus N....... 38
3.10 Ripple and transition region of Kaiser versus N............... 38
3.11 Ripple and transition region of Normal versus N............... 39
3.12 Ripple and transition region of Von Hann squared
versus N...................................................... 39
TABLES
Table
1. Continuous signals..................................... 20
2. Band Limited sampled signals........................... 22
3. Non Band Limited sampled signals...................... 23
X
3.13
3.14
Ripple and
versus N...
transtion region of Hamming squared
i
Ripple and
versus N..
transition region of Inverse Von Hann
3.15
3.16
Ripple and
squared versus N
transiton region of Inverse Von Hann
Ripple and [transition region of Inverse Hamming
versus N.....J.............................................
3.17 Ripple and transition region of Raised Cosine
versus N...J...................................................
3.18 Ripple and transition region of Sine versus N...................
3.19 Ripple and transition region of Sine squared versus N..........
I
3.20 Ripple and transition region of Inverse Hamming squared
versus N......................................................
40
40
41
41
42
42
43
43
3.21
3.22
3.23
3.24
Truncation of Non band limited Von Hann window....
Truncation of Band limited Inverse Von Hann window,
j
Ripple and transition region of Sine window of N =15
with bandwiefth varying................................
Ripple and transition region of Sine window of N = 25
with bandwidth varying...................:...................
45
46
48
49
CHAPTER I
I INTRODUCTION
I
!
This thesis is a study of window functions, used in digital filter
design including a comparison of windows, and the development of software
for analysis of each window.
In chapter'll, all of the windows are classified such as continuous
windows, band limited sampled windows, non band limited sampled
i
windows. The uncertainty relationship of each windows is calculated. Also
i
the general form of; the uncertainty, relationship for the sampled data is also
formulated. The loss of frequency resolution, which is caused by the
i
truncation in the window function or window spectrum is shown by the
i
definitions of the rms bandwidth and rms pulse width. An example of the
effect of aliasing and truncation error is shown analytically and graphically.
The bandwidthpulse width product of a signal can not be less than
a certain minimum value. This is a mathematical phenomenon of the
interdependence of time and frequency which prevents arbitrary
specification of signals in the time and frequency domains. Arbitrary
functions of time or, arbitrary spectra can be specified, but both cannot be
specified together. This is known as the uncertainty relationship for Fourier
transform which is analogous to the relationship between the energy of a
particle and the timd it has that energy, known in Quantum Mechanics as the
principle of complimentarity or the uncertainty principle.
The uncertainty relationship of window functions is based on the
I
rms pulse width AT and rms bandwidth AF, defined in the next chapter. It
i
can be shown that AT. AF > 1/4rc. If a window is used for which AT. AF is less
i
than the above value,large aliasing and truncation error occur. In the case
of bandlimited window functions which are used with sampled data, the
product of AT. AF b> 1/4rc for all cases. In the case of continuous window
functions, equality;occurs for a Gaussian exponential window, but such a
function does not ojccur with sampled data. The Normal window is not band
limited and has no counterpart among band limited signals.
Non band limited window functions, used with sampled data,
cannot be judged by calculating AT. AF alone, since the amplitude spectrum
is not zero at the'Nyquist frequency. The processing of sampled data
I
implies band limited signals. If a non band limited window is used with
sampled data aliasing occurs because of the overlapping of spectra at
higher frequency. A window function which is not band limited by definition
exhibits aliasing.
A finite pulse width implies the truncating of sampled data which
leads to aliasing as well as truncation error in the resulting spectrum. No
good results will be obtained from a small number of samples of signal.
Some graphs in chapter II will show this effect of truncating.
!
Chapter III discusses the characteristics of windows. The effect of
i
each window on the; prototype lowpass filter response is studied and plotted,
particularly band limited window functions. The search of new windows and
!
the "best' window was also performed.
Windowing boncept is introduced because of the effects of aliasing
i
and truncation. Window functions are often used to modified the sampled
data or to improve! the frequency filter response of a digital filter by
I
3
multiplying the sampled data or filter coefficients by window coefficients,
equivalent to convolving the window spectrum with the spectrum of the
unmodified data or of the filter spectrum. In general, the reduction of side
lobes increases the bandwidth of the window spectrum. Therefore, there is
a tradeoff between the frequency resolution and the size of ripples. In other
i
words, reduced ripple causes a loss of frequency resolution.
t
Even though aliasing and truncation error occur because of
truncation, it is still desirable to determine the spectra of sampled data; or in
the case of digital filter, to obtain a finite length filter meeting some
specification. Digital filters still have many advantages such as they can be
i
implemented with Software running on a general purpose computer. Thus
they can be designed and tested easily. Therefore, the windowing process
which represents the truncation in digital filter design is too important to be
limited to only non band limited windows which have been used in the past.
Throughout this thesis, different kinds of windows are studied such as
nontraditional band limited windows and traditional non band limited
i
windows. In this thesis, all the window functions are used extensively with
the nonrecursive prototype low pass filter which has the ideal low pass
spectrum of a rectangular shape.
Chapter IV; contains discussion and conclusions of the thesis.
I
Because of the consequences of truncating filters to the finite terms, the
i
ripple and transitionj region are generated. All the window functions, band
limited or non bancl limited, actualy reduce the effect of truncation. The
independence of tljie bandwidth and the number of coefficients is an
I
advantage for all band limited windows.
CHAPTER II
CLASSIFICATION OF WINDOW FUNCTIONS
I
2.1 Truncation error and aliasing
Window functions are used to modify the time domain sampled
signals to reduce the effect of truncation. In other words, to avoid truncating
signals sharply to reduce the effect of the truncation error in the Fourier
spectrum, or to modify the impulse response of the digital filters. In the latter
i
case of the digital filters, traditionally, non band limited windows have been
used in digital filter:design. Band limited windows, whose spectrum is zero
at the Nyquist frequency, will be studied closely here.
As is known, the ripple and transition region of the filter response
are determined by the truncation of a potentially infinite length filter. The
truncation can be expressed as a windowing process. The filter response is
the periodic convolution of the window response and prototype filter
response in the frequency domain (which will be proved in chapter III).
Because of this convolution, the ripple and transition region are generated.
The ripple is caused by the side lobes of window's spectrum. The transition
j
region is caused by !the main lobe of the window's spectrum.
i
Theoretically, bandlimit window functions can improve both the
transition region and the ripple, since band limited window functions do not
have side lobes and have a main lobes of controllable width. Therefore, the
transition region can be controlled and the ripple reduced. However, when
6
By definition, the finite pulse width window function has nonband
limited spectrum which has some sidelobes causing the aliasing. Therefore
the truncation of the sampled signals in order to get a finite pulse width
causes the truncation error in the resulting spectrum. This leads to the
conclusion that no; good result will be obtained from a small number of
i
samples of signals, no matter what window is used, since truncation error
occurs when the sampled signal is truncated. The following example will
illustrate both aliasing and truncation error of a signal.
Consider a nonband limited signal x(t) = exp(at) u(t) with samples
x(n) = an u(n) with ;a = exp(aT) where T is sample increment. The true
spectrum of this signal is
X(f)1 (2.1)
a + j27tf
The spectrum of thejsample value, which contains aliasing is
oo T
X(f) = T Â£ an exp(j2n7tfT) =  (2.2)
n=0 1 a exp(j2;cfT)
j
Note that as the sample increment T approaches zero then use Taylor's
expansion for exp(x)i= 1 x as x approaches zero, equation (2.1) reduces to
the true spectrum, using a exp(j2jifT) = exp(atj27ifT) 1 aT j27ifT. An
infinite sample rate jis needed to eliminate aliasing in a nonband limited
signal. j

Truncation error occurs if a finite number of terms are used. Thus
!
the window is of fijnite length, there is always a tradeoff between the ripple
and the transition! region. In general, when the ripple is minimized by a
fixedlength filter,' the transition region increases. In other words, the
bandwidth of the Window spectrum is larger which causes the loss of the
frequency resolution, because the condition for this resolution is the
I
bandwidth of the: window spectrum at the halfpower points (the 3dB
i
bandwidth). The 'separation in frequency of two equal main lobes by less
than their 3dB bandwidths will appear as a single spectral peak, therefore
they will not resolve as two distinct lines [4]. Figure 2.1
a) nonresolvable
Figure 2.1: The resolvable and
A window function or its spectrum can be specified to be constructed
accordingly, but cannot be constructed independently. A finite pulse width
i
(AT) window function gives a non band limited window spectrum. A band
i
limited (AF) windo\ftj function gives a window of infinite duration. There is a
relationship between AT and AF such that the product of AT and AF is greater
or equal to 1/4n kncjwn as the uncertainty relation.
As mentioned before.the bandwidthpulse width product of a signal
i
is a mathematical! phenomenon of Fourier transforms indicating the
I
interdependence of time and frequency which prevents arbitrary
j
specifications of signals in the time and frequency domains.
nonresolvable spectrum line
7
N1 I
X(f) = T S ane*p(j2n;tfT) = T
n=0
1exp(aNTj27ifNT)
1 exp(aTj27tfT)
(2.3)
This spectrum contains both aliasing and truncation error. Figure 2.2 will
show the aiiasing and truncation error of the above signal.
X(f)
2.2 Uncertainty relation
For any given window function the uncertainty relation is based on
the rms pulse width i(AT) and rms bandwidth (AF) which is a mathematical
j
property of Fourier transform pairs. This will be developed for continuous
signals and for sampled data.
2.2.1 The continuous function
I
8
For a given continuous window function w(t) with the Fourier
I
spectrum. :
o
W(f) = J w(t) exp(j27ift) dt
oo
By Parseval's theorem, if W(f) is a spectrum of w(t) then
j  W(f) 2 df = J** w2(t) dt
oo oo
Also
dW(f) oo
= J j2jct w(t) exp(j27rft) dt
df 
Thus
f  f df = 7 I 2jct w(t) 2 dt = 47t2 fw2(t)
oo (jf . oo oo
The rms pulse width. AT is defined by [3]
J t2]w2(t)dt
oo
AT2 = j (2.4)
7vl2(t) dt
i
i
i
9
From Parseval's theorem above it follows that
AT2
i
1
4 7t2
oo
1
dW
dT
2
df
1  W(f)2df
(2.5)
The rms bandwidth AF is defined by [2]
7 f? W(f)2 df
oo j
AF2 = ; (2.6)
7 W(f)2 df
OO
Again by Parseval's! theorem
dw(t) 2
; t ii dt
_ 1 i < dt
AF2 ! (2.7)
4tt^ 1 oo
: J I W(f) 2 df
i oo
i
i
Combining equations (2.5) and (2.6), therefore
Aj2AF2 =
4tc2
oo dW(f) 2
J   df / f2 W2 df
df
J W(f) 2 df 
Using Schwarz inequality [3] of 2 complex functions F(f) and G(f)
J (F*G +FG*)df  2 < 4 fW* df f GG* df
OO oo oo
dW dW* dW
Let F = f; G = W I also  
df df df
dW  2
~~dT
Then
.oo dW* ; dW 2 oo dW 2
J (fW+ fW) df  < 4 J f2df J W2 _________ df
oo df df "oo oo df
Thus !
AT2.AF2
1 j .oo dW* dW 2
L J (fW+ fW*) df 
16tc? oo df df
^ _j
!  J W2 df 2
I
11
Since
d W(f)2
df
dW* dW
W + W*
df df
Then
AT2AF2 >
1
16^2
I S
d
f_
df
W2 df 
2
00 2
 J W2 df 
Integrating by part with u = f, dv = d W2 and assuming that
f W(f)2 = o as f approaches infinity gives
1
ATAF > 
4tc
Equality in the above occurs if the following first order differential
equation is satisfied:
d W(f)
= kf W(f) where k = constant
df
The only solution to this differential equation satisfying the condition fW2 =
0 as f > oo, is the Gaussian exponential
W(f)= (7i/a)1/2exp(7c2f2/a)
with
AF2 = a/47t2
The Inverse Fourier transform w(t) is
w(t) = J W(f) exp( j27tft) dt = exp(at2)
oo
with
AT2 = 1/4a
Therefore
AT.AF = 1/47C
A Normal window gives the smallest product ATAF or the best resolution of
all window functions.
If the window spectrum is arbitrarily truncated, or has any finite
discontinuity, then dW(f)/df is infinite at some.frequency and AT is infinite
based on equation 2.5. A similar argument in the ti.me domain shows that if
the window function has any finite discontinuity then dw(t)/dt is infinite at
some time and AF is infinite based on equation 2.7. The truncating of a
window or spectrum results in a loss of resolution since the product of AT
and AF is infinite.
2.2.2 Sampled data
For a given discrete window function w(k) or a sampled function of
w(t) at tk = kT with the band limited spectrum W(f):
1 3
OO
W(f) = T I w(k) exp(j27cfTk) f < B
k=oo
With bandwidth B < fs/2 where fs = 1/T is the sample rate
By ParsevaPs theorem J  W(f) 2 df = T Z w2(k)
fs/2 k=oo
Also
dW(f)
= T Z (j27cTk) w(k) exp(j27rfTk)
df k=~
Therefore
fs/2 dW 2 00 _
J 1 df = T Z 4tt2t2 k2 w2(k)
fs/2 df k=oo
The rms pulse width AT is defined:
TZ T2 k2w2(k)
k=
TZ w2(k)
k=~
By Parseval's theorem
AT2
1 fs/2 dW(f) 2
5 I I1 df
4k2 fs/2 df
/ W(f)2 df
fs/2
The rms bandwidth is defined by
1 4
AF2 =
J f2 W2 df
fs/2
fs/2
J
fs/2
W2df
AT2 AF2
fs/2 dW 2 fs/2 _
j ___________ df J f2  W 2 df
1 fs/2 df fs/2
16k2
 J [W2 df
fs/2
2
As it was proved previously:
1 5
AT2.AF2 Â£
167?
fe/2 dW* dW 2
J fW + fW*) df 
fg/2 df df
W2 df 
2
Again by Parseval's theorem
AT2.af2 >
16tc2
W2 d 2
J fW2 df 
fs/2 df
fg/2 " 2
 J W2 df 
fs/2
Integrating by part with u = f, dv = d W(f)2, W(fs/2) = 0 gives
1
AT.AF >
4ti
The equality occurs when dW/df = kfW(f). However, no band limited
window function satisfies this differential equation and the boundary
condition of W(+fs/2) = 0. In other words, no band limited window function
satisfies AT.AF = 1/47t Therefore, all the band limited window functions gives
AT.AF > 1/4tc
For a non band limited window function AT.AF > 1/47t does not apply, since
assumption of W(fs/2) = 0 is not true. So the product AT.AF can not be used
to judge the properties of nonband limited signals. The following example
will indicate the idea.
A given signal w(k) = 8(k), its spectrum W(f) = 1 gives AT = 0, AF =
fs/121 therefore AT.AF = 0. Thus, non band limited windows may not be
judged by calculating AT.AF.
2.3 Constructing band limited window functions
The band limited window spectrum is an even function so is its
window function
oo oo
w(t) = J W(f) cos(27ift) dt = 2 J W(f) cos(2icft) dt (2.8)
OO 0
oo oo
W(f) = J w(t) cos(2rcft) df = 2 Jw(t) cos(2n:ft) df (2.9)
OO 0
From Equations (2.8) and (2.9) above, we see that W(f) and w(t) become
interchangeable. Therefore, all of the non band limited window spectrums
can become the band limited window functions with all the parameters
interchanged such as T (the sampled interval) and B (bandwidth of the
spectrum) interchanged; t and f (independent variables in time and
frequency domains) interchanged. The following example illustrates the
idea: The nonband limited rectangular window is given by
,1 Jt
w(t)={ , W(f) = 2Tsinc(27tfT)
0 . t > T
While the band limited sine window is
1 1 ,f
{
2B 0 f > B
w(t) = sinc(27tBt)
W(f) =
1 7
2.4 Classification of Windows
Most of the window functions that have traditionally been used with
sampled data are not band limited. The Fourier spectrum of samples of
signal which is not band limited is periodic and contains aliasing. Therefore,
a sampled signal should be a band limited one, if not, aliasing will occur.
Thus, there are three classes of window functions as follows:
1. Those based on continuous signals.
2. Those based on samples of band limited signals.
3. Those based on samples of non band limited signals.
The properties of class 1, continuous window functions can be determine by
calculating AT.AF by using their definitions of equations (2.4) and (2.6). A
number of cases are compared in Table 1. The properties of class 2 and 3
are somewhat more difficult to determine since the spectrum of a sampled
window function is not easily integrate in a close form. A number of band
limited windows are shown in Table 2. A number of non band limited
windows are shown in Table 3.
In the case of sampled data, the rms pulse width AT is easily
calculated using
I k2 w2(k)
. k=
AT2=T2_________________
I w2(k)
k=oo
(2.10)
If w(k) is not of finite duration then the sum may be continued until k2w2(k) or
w2(k) is negligible, assuming w(k) approaches zero sufficiently rapidly.
The rms bandwidth AF can be calculated from the coefficients of
window functions using
W(f) = T X w(k) exp(j27ifTk)) (2.11)
k=
AF2 =
fs/2
J f2 W2 df
fs/2
fs/2
1 W2 df
fs/2
(2.12)
Substituting W(f) of equation (2.11) into AF2 equation (2.12), the rms
bandwidth AF2 can be determined by the sample signal
X
k=oo
X w(k) w(l) A(k,l)
l=oo
X w2(k)
k=oo
where A(k,i)
1/12 , k = I
('1)M
27t2(kl)2 *
(2.13)
Equation 2.13 gives a correct AF whether or not the windows are band
limited or non band limited. With the use of the computer, a AF of any
window can be determined. Therefore, some of complicated windows in
table 2 and 3, their AF's are calculated by using this method, not integrated
analytically.
20
Table 1: Continuous signals
Window Spectrum band limitec ? 47CATAF
Rectangular f 1 t < T 1 0 t > T 2T sinc(2jtfT) no ATT/31/2 AF OO 471ATAF *= oo
sine sinc(27tBt) , 1 f[ B { 2B 0 ,f>B yes AT = oo AF = B/31/2 4n ATAF =oo
Hamming r a + b cos(7it/T) t < T l 0 t>T 2f2(ab) a/212 Tsinc(27tfT)  f ?1/4T2 no AT = T( g 16ab2b2)1/2 3 2n AF oo 471ATAF oo
Inverse Hamming Rin^pirRt) 2t^ab) a/2Ep 1 I a + bcos(7tf/B) f < B B1 0 ,tf>B yes AT *= oo AT b/ 16abb2 V2
2 2 t 1/4B iT ( 3 22 4tiATAF = oo
Triangular / 1 ItkT tT 2 T sine (7rfT) no AT = T/101/2 r 1/2 AF 3 /27tT 4tiATAF 1.0954
sine squared sinc^ (nBt) 1 1 f/B ,fB yes 1/2 AT = 3 /2tiB 1/2 AF B/10 4tiATAF 1.0954
Von Hann r 1/2 + 1/2cos(7it/T) ,tT Tsinc(2jrfTI 1(2fT)2 no o 1/2 ATT(''f"2)2 AF1/T121/2 4tcATAF 1.0262
Inverse Von Hann sinc(2nBt) 1 (2Bt)2 2/I/2 + 1/2cos(7rf/B). f < B "Bt 0 f > B yes AT = 1/Bl2/2 / 1 15/2ti2\1/2 AFB( 3 ) 4tiATAF 1.0262
21
Table 1: Continued
Window Spectrum band limitec ? 47TATAF
Normal exp(at2) 1/2 p p (n/a) exp(7c^/a) no AT 1/2a1/2 AFa1/2/2rt 471ATAF = 1
Kaiser 21/2 Io(o (1 (t/T) 1 ) Io(a) Io(a) 2Tsinc(((27rfT)2 2 )12) no AF = > 4nATAF = <*>
Inverse Kaiser sinc(((2rcfT) a2)1/2 ) 1 Io(a (1 (f/B) 2j'2) f s B 2B * o f > B yes AT = oo 471ATAF =
22
Table 2: Band Limited Sampled Signals
Window Window Spectrum 4tcATAF
sine squared 2 sme (jrBTk) 1 r 1 f/B f< B B 0 lf> B 4T. 3'/2/2B 1/2 AFB/10 4nATAF 1.0954
Inverse Von Hann Sine 2rrBTk 1 (2BTk)2 1 { 1/2 + 1/2 cos (rrf/B), f B AT = 1/B121/2 r 2 ,1/2 AF b[C115/22t_)] 4JIATAF 1.02623
sine sine (2rrBTk) 1 r 1 HI SB 2B 1 0 f> B AT < AFB/3172 47CATAF oo
Inverse Hamming 2(X^ab) a) sine (2rtBTk) XZ 1 where x= 2BkT 1 ra +bcos(rrf/B) ,f[sB B 0 f> B AT oo 4F.BrL. 2n3 / 4jtATaF oo
Raised Cosine cos(nx) sincn(f1+B)kT' 1 (2x)\ where x(Bf1)kT f 1 ff1 Jl/2 + 1/2cos(rt^__.) ,fi<fB where a 1 f1 +B AT= l/(l2(Bf1)(B+5f1/3))1/2 ..3 2 1/2 /ii+ x/8 (y/4rr) (15B+17f1)\ ) x f1 3y/8 where 3 3 xB f1 y B f1
Inverse Von Hann squared 2 / sinc2nBkT \ 1 (2BkT)2' (1+ .5cosx) ( f + 2B) + Bsinx Aj Tf f S 2B l 0 f > 2B where x = Jtf/B 2 A = 1/4B AT Eq(2.10) AF Eq(2.13) 4nATAF 1.0026
23
Table 3: Non band limited sampled signals
Window T: Sample increment Spectrum 4nATAF
Rectangular r 1 k < m 1 0 k > m T sin(2m+1 )0 0 =jrfT sine AT Eq(2.10) AF Eq(2.13) 4nATAF > o m>~
Hamming T(2a \p(B)X(6) + by(e n/m)X(0Ji/m) AT Eq(2.10)
r a + bcos(7tk/m) k < m + b y(e+ n/m) X(0 + n/m) (a+b) ] AF Eq(2.13)
l 0 k >m where e = 2rrfT 4tcATaF >oo
a+b=1 V(9) exp(j y 0) sin(mÂ£l) 0 X( 0) sin(i) m>~
Von Hann TIV(B)X(0)+ .5V(0Jt/m)X(07t/m) 2 1/2 AT mTr(115/27i Jj
/ .5 + .5cos(7tk/m) k < m 0 ,k>m + .5 V (0 + rVm) X(0 + 7c/m) 1 ] L 3 J
where 0 2jrfT 1/2
V(0) = exp(j y 0) sin(m+1)0 AF1/12 mT
X(0) Jr sinf) 4ATAF 1.0262
Triangular JHsin(e) exp(jJ^Le) sin(iILe ATmT/(1oV2
r 1 k/m k < m TexDf m/2t 2 ^ 2 1/2 AF 3 /2nmT
1 0 K > m m sinM)
2 4tiATAF 1.10
where e 27tfT
Normal 1/2 2 2 (n/a) exp(rr r /a) _ 1/2 AT 1/2a
exp( aT^k2) _ 1/2 AFa /2n 4tcATAF 1
CHAPTER III
FREQUENCY RESPONSE AND WINDOW CHARACTERISTICS
3.1 Frequency Response of Digital Filters
As is known, window functions are to mitigate the effect of the
truncation in digital filter design because we can not have infinitelength
filter. In order to truncate a filter to a finite number of terms can be thought of
as multiplying the prototype lowpass filter by a window function. The
prototype lowpass filter and window coefficients are denoted by Ck and w(<
respectively. In general, the filter frequency response is defined as
following:
oo
H(f) = T y Wk Ck exp(j2nfTk)
(3.1)
where T= 1/fs with fs is the sample rate. The equivalent convolution formula
is
fg/2
H(f) = J W(ff) Hp(f) df (3.2)
fs/2
In order to prove the convolution formula
Let
25
fc/2
Ck = J Hp(f) exp(j27rfkT) df
fs
where Hp(f) is Fourier transform of the prototype lowpass filter
and
m
W(f) = TX Wkexp(.j27cfkT)
k=m
Then
oo
H(f) = TX WkCkexp(j27tfkT)
k=>
becomes
oo fg/2
H(f) = TX wk J Hp(f')exp(j2jtfkT) df exp(j27ifkT)
k=oo fg/2
fc/2 m
= J Hp(f') TX wkexp(j2^(ff )kT) df
fg/2 k=m
fc/2
= 7 Hp(f') W(ff) df
fs/2
(33)
This expression of H(f) above shows that the multiplication in the time
domain corresponds to the convolution in the frequency domain where W(f)
is the window spectrum and Hp(f) is the prototype lowpass filter spectrum.
All the window functions have a common property in that they are
even functions of time when centered at the origin. Therefore, their
coefficients are symmetric that is Wk = w_k. In the case of nonrecursive
prototype low pass filter, which is used to study in this thesis, is also an even
26
function, therefore, its coefficients are also symmetric that is Ck = c_k the
Fourier spectrum of the prototype filter is shown in Figure 3.1.
Hp(f)
1
fs/2 fs/2
Figure 3.1: Prototype low pass filter spectrum.
The rectangular shape of the prototype low pass filter spectrum in
the frequency domain corresponds to the coefficients Tck =
(2B/fs)sinc(2reBTk) in the time domain. Since the coefficients of the
prototype lowpass filter and windows are symmetric, the imaginary part of
the expression of the filter response H(f) in equation 3.1, which is truncated
to N terms, is zero. Therefore, it is left with the real part as following:
N
H(f) = c0w0 + 2 I Ck Wk cos(27tfTk) (3.4)
k=1
The amplitude frequency response has significant oscillations
around transition in the prototype lowpass filter response. This is called
ripple. The period of the ripple decreases as the number of .terms N
increases. The amplitude frequency response does not follow the
infinitesimal transition response of prototype filter. The desired response of
a low pass filter changes abruptly from 1 to 0 (as from passband to
27
stopband) as shown in Figure 3.1, but the finitelength Fourier filter changes
slowly. This region of gradual change is called the filter's transition region.
The width of the transition decreases as the filter is made longer. The
example of an amplitude frequency response is shown in Figure 3.2.
Amax = max H(f) (3.5)
0
Amin = min H(f) = H(f) (3.6)
0
Smax = max H(f) = H(f?) (3.7)
f2
The definitions for passband ripple, stopband attenuation, transition region
28
as following:
Am 3x Passband ripple = 20loq( ) dB (3.8)
Amin
Stopband attenuation = 20log (Smax ) dB (3.9)
Transition region = (f2 fi) Hz (3.10)
The program was written to calculate the passband ripple, stopband
attenuation, transition region based on the above equations and definitions.
3.2 The Construction of the Program
With band limited windows, there are 2 parameters to be varied, the
bandwidth and the number of the coefficients of the window. Therefore, at
the beginning of the program, the parameters to be varied are specified by
the user. There are two subroutines that are Called Nvaried subroutine and
Bvaried subroutine. Each subroutine is described as following:
A. Nvaried subroutine: This subroutine calculates the passband
ripple, stopband attenuation and transition region for each value of N which
is number of coefficients of the window and then plots them all on the same
graph versus N. In this subroutine, the magnitude or dB of the frequency
response for a particular number of coefficients and a particular bandwidth
of the window can also be plotted. Variables to be specified in this
subroutine are:
* The selection of one of windows that is listed.
* The sample rate,fs.
* The number of points (program variable is npoint) to be calculated and
plotted from 0 to fs/2. In the case the magnitude or dB of the filter's frequency
response to be plotted, the more points to be plotted, the better the
frequency accuracy on the computer screen. Also, these points will be used
29
as the initial guesses in the Newton's method.
* The bandwidth of the prototype lowpass filter.
* The bandwidth of the window.
* The number of coefficients from which to start to plot.
* The total number of coefficients to be plotted.
* The number of iterations to be used in Newtons method.
Nvaried subroutine consists of coefficients subroutine, pointplotted
subroutine, curve subroutine, passband subroutine,stopband subroutine,
transition subroutine. These subroutines calculate the ripple and transition
region of the filter's frequency response. There are also some accessory
subroutines to do the plottings. Newton subroutine is included using
Newton's method to obtain accurate frequency.
B. Bvaried subroutine: This subroutine calculates the passband
ripple, stopband attenuation, transition region for each value of B which is
the bandwidth of the window and then plots them all on the same graph
versus the bandwidth of the window. In this subroutine, variables to be
specified are:
* The selection of one of the windows that is listed.
* A particular number of coefficients.
* The sample rate, fs.
* The number of points to be plotted from 0 to fs/2.
* The window's bandwidth from which to start to plot.
* The bandwidth of the prototype lowpass filter.
Similar to the Nvaried subroutine, it consists of coefficients
subroutine, pointplotted subroutine, curve subroutine, Bpassband
subroutine, Bstopband subroutine, Btransition subroutine, and some
30
accessory subroutines to do the plottings. Newton subroutine is included
using Newton's method to obtain accurate frequency.
Descriptions of the subroutines in the Nvaried and Bvaried
subroutines follow:
The coefficient subroutine: Calculates the coefficient values of a
particular window W< and of the prototype lowpass filter Ck, and then
determines the coefficients of the filter h< by multiplying w^ by q<.
The point plotted subroutine: Calculates values of the magnitude of
the filter response (see Figure 3.3) at equally spaced frequency from 0 to
fs/2. It also searches for approximate frequency fmjd at which H(fmjd) = .5.
Using this frequency, stopband is in the frequency above fmjd, passband
below fmid. These frequency ranges will be determined in the curve
subroutine following. Newton's method is used to obtain an accurate
frequency fmjd.
Figure 3.3: Magnitude response with frequency ranges shown.
31
The curve subroutine: Determines approximate frequency fSfart at
which the transition of the filter response begins, which means that the
magnitude response is at its maximum. Searching all the calculated values
starting at fmjd going toward lower frequency, magnitude will increase to the
approximate maximum value. The next value after the maximum will be used
as an initial guess in Newton's method to obtain accurate frequency fstart
Magnitude at this frequency fstart's Amax. In similar way, Amin is found.
Amax and Amin of equations (3.5) and (3.6) are used to determine the
passband of the filter response. Smax of Equation 3.7 of the stopband can
be obtained by searching for the frequency fst0p in the interval [ fstart fs/2 3
at which the transition stops, or at which the magnitude response starts to
oscillate again. The maximum of the filter response in the frequency interval
of [fstop, fs/2] is Smax.
The passband subroutine: Calculates the passband ripple of the
filter by using Equation 3.8 (20log Amax/Amin).
The stopband subroutine: Calculates the stopband attenuation of
the filter by using Equation 3.9 (20log Smax)
The transition subroutine: Determines the transition region by AF =
(f2_f 1) where f1 is found by searching from f = fstart to f = fmjd such that
H(fj)= Amin, 12 is found by searching from fmjd to fSf0p such that H(f2) =
Smax.
Newton's subroutine: This subroutine is used in the search for
Amax, Amin, Smax to obtain the good frequency accuracy at the maxima
and minima of the response H(f). At the maxima and minima of the filter's
frequency response H(f), the derivative of H(f) is zero. Equation 3.4 of H(f)
32
can be written as
H(0) = CqWq + 2
Ck wk cos(0k)
where 0 = 2%fT
Therefore, derivative of H(0) is zero at the maxima or minima of H(0) as
following
d(H(0)) M
= z. k CkWk sin(0k) = 0
d0 k=1
Using d(H(0))/d0 as a function which has zeros in the interval [O.fs/2]
d(H(0))
Let f(0) =  = 0
de
f(0) = ^ k WkCk sin(0k) = 0
k^1
The solution for f(0) above is [5]:
0n+1 = n "
f(en)
33
where
f(n)
d2(H(6))
de2
= ^ k2wkckcos(0k)
When Newton's method is used, an initial guess has to be given, the
number of iterations and accuracy have to be specified. In this program, the
number of iterations is asked. The accuracy of 10"9 is specified in the
subroutine. The initial guess for each solution is given by obtaining the
approximate frequency at the maximum or minimum of the filter frequency
response in the pointplotted subroutine.
In the case of the triangular window, at some particular numbers of
coefficients, Smax can not be determined, since the maxima and minima
never occur after the transition region. In other words, the magnitude
frequency response decreases monotonically in the stopband Figure 3.4.
Figure 3.4: The magnitude response of the filter decreases
monotonicallly in the stopband
34
Based on the investigation of this window, if the number of
coefficients N is equal to a multiple of 5 such that N = 5, 10, 15 ... 50.
Maxima and minima never occur after the transition region. Thus, Smax
can not be determined. Therefore, in order to plot passband, stopband,
transition region versus number of coefficients for this window, there is a
subroutine called dottedline subroutine to draw a dotted line at these
numbers of coefficients, N = 5,10...50. Figure 3.5.
(3) (2)
240 30
216 27
192  24
168  21
144 18
120 " 15
96 12
72 ' 9
48 6
24  3
0
\
i
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
"x
J 0,9
e,B
 0,7
I 0,6
10.5
1 0,4
i 0,3
I 0,2
10,1
10 IS 20 25 30 35 40 45 50
Figure 3.5: Ripple & transition region versus coefficients N of
the filter response with triangular window used.
3.3 Window Characteristics
In general, a window spectrum consists of a main lobe and
sidelobes,Figure 3.6.
35
Window spectru*
A
/ I \
Inain V
sidelobes
I lo >e \
\
\ sidelobes
frequency
a) Non band limited of Rectangular window with N = 5.
Window spectruw
A
/lole\
sidelobes
/
/
\ sidelobes
frequency
b) Band limited of Sine window with N = 5.
Figure 3.6: Window spectrum of Non band limited and band limited.
Any window which gives the main lobe as narrow as possible and
the sidelobes as small as possible is considered to be an ideal window.
These two conditions of a window can not be simultaneously minimized.
Most of the windows are a suitable compromise between these two
conditions. A window function which has a narrow main lobe, gives sharper
transition but suffers from some oscillations in the passband and large
ripple of the stopband. Conversely, a window function which has small
sidelobes gives smooth amplitude response in the passband and small
ripple in the stopband, but suffers from gradual transition. Therefore, the
ripple and transition region of the filter response are generated by this
36
windowing process. Because of the convolution of the prototype lowpass
filter spectrum and the window spectrum, the width of the transition region is
directly related to the width of the window spectrum's main lobe and the
amplitude of the ripple at the passband and stopband are proportional to the
amplitude of the sidelobes. Thus, a window which gives the narrowest
transition region, largest stopband attenuation, smallest passband ripple
with any set of window coefficients of the same length is to be consider the
best.
During the process of plotting stopband attenuation, passband
ripple and transition region versus number of window coefficients, based on
Figures 3.73.20, with the sample rate fs = 1000Hz, the bandwidth of the filter
is 200 Hz, the bandwidth of the window is 20Hz,the following are observed:
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.7: Ripple and transition region of Von Hann versus N.
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.8: Ripple and transition region of Hamming versus N.
38
Figure 3.9:
2: Stopband attenuation in dB.
3: Transition region in Hz.
Ripple and transition region of Rectangular versus N.
(3)
188
98
78
68
58
48
38
28
18
(2)
38
(1)
2.8
5 18 15 28 25 38
35
48 45
58
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.10: Ripple and transition region of Kaiser versus N.
39
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.11: Ripple and transition region of Normal versus N.
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.12: Ripple and transition region of Von Hann squared versus N.
40
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.13: Ripple and transition region of Hamming squared versus N.
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.14: Ripple and transition region of Inverse Von Hann versus N
41
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.15: Ripple and transition region of Inverse Von Hann squared
versus N.
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.16: Ripple and transition region of Inverse Hamming versus N.
42
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.17: Ripple and transition region of Raised Cosine versus N.
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.18: Ripple and transition region of Sine versus N.
43
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.19: Ripple and transition region of Sine squared versus N.
1: Passband ripple in dB.
2: Stopband attenuation in dB.
3: Transition region in Hz.
Figure 3.20: Ripple and transition region of Inverse Hamming squared
versus N.
44
1. The traditional nonband limited window's ripple is unaffected by making
the filter longer, only the transition region can be reduced by lengthening the
filter. In other words, each window has almost constant stopband
attenuation and passband ripple as number of coefficients N increases.
Therefore, when looking for new window, the ripple is primary concern.
Since any of these windows has smaller ripple, generally has wider
transition region. The window can be made longer to take care of the wider
transition region.
2. There are a few interesting observations about the non traditional band
limited windows. The ripple decreases as N increases, the transition region
decreases  slightly, however, not as abruptly as nonband limited ones 
as N increases. It is desirable that the stopband attenuation increases,
passband ripple and transition region decrease as N increases.
Theoretically, band limited windows are supposed to be ideal ones, since
they have only main lobe with no side lobes. The width of the main lobe is
the bandwidth of the window spectrum which is controllable, therefore the
transition region can be controlled. With no side lobes, windows are
supposed to generate no ripple. However, because of the terminating the
Fourier transform to the finite number of terms, the ripple also occurs with
band limited windows, Figure 3.6b. Nevertheless, the above conditions of
stopband attenuation, passband ripple and transition region obtained with
the use of band limited windows are preferable to the non band limited
ones, since as N varies, the ripple and transition region vary simultaneously.
Certainly, band limited windows have more advantages than the non band
limited ones. They will be illustrated in the later section.
3. The similarities and differences between nonband limited and band
45
limited windows are following: In the case of nonband limited windows, the
prototype lowpass filter is multiplied by a finitepulse width window in the
time domain, that is equivalent to the convolution between the prototype
lowpass filter's spectrum with a window's spectrum which has a main lobe
and sidelobes of a sine function in frequency domain. The fewer the
coefficients, the faster the filter is truncated. The more the coefficients, the
slower the filter is truncated. Figure
IKk)
k
a) Faster truncation N =10
Figure 3.21: Truncation of Non band limited Von Hann window.
The fewer the coefficients, the wider the transition region. Conversely, the
more the coefficients, the narrower the transition. In the case of band limited
windows, the prototype lowpass filter is multiplied by a infinitepulse width
window which is a sine function in the time domain. Therefore, the number
of coefficients actually has a different role in how the filter is truncated. If the
number of coefficients is small then the filter is truncated almost as sharply
as the rectangular window. If the number of coefficients is as large as the
first zero crossing of the window is truncated, then the window will respond
in the same way of the nonband limited one such as the more the
coefficients, the narrower the transition or the fewer the coefficients, the
.21
WM
b) Slower truncation N = 50
46
wider the transition region. Figure 3.22
a) As sharp as Rectangular N = 10 b) Truncation beyond the first zero
crossing N = 50
Figure 3.22: Truncation of band limited Inverse Von Hann window.
To verify similarities and differences above, based on Figure 3.7
3.20, we see that with nonband limited windows, at very small number of
coefficients such as N = 5 for instance, the transition region is very wide and
as N increases the transition narrows. With band limited windows, at N=5
the transition region and ripple of all windows are very much the same as
the rectangular window. However, all windows (except the Inverse Von
Hann Squared and the Raised Cosine) have the same characteristic that is,
after a certain number of coefficients, it does not matter how longer the filter
is made, the ripple and transition region of a window are almost constant.
Thus, there is no point to make the filter longer if no more improvement in
ripple and transition region can be obtained. During the process of the
band limited window investigation, the constant ripple and transition region
start at the first zero crossing truncation, again except the Inverse Von Hann
Squared and Raised Cosine, which have the transition region increase after
the first zero crossing truncation. As mentioned earlier, there is no point to
47
truncate the window further than the first zero crossing, since all windows
will give constant ripple and transition region after the first zero crossing is
truncated. If a window's first zero crossing truncation is considered to be
maximum length of the filter the Inverse Von Hann Squared is a good
window since it gives the largest stopband attenuation, smallest passband
ripple and narrowest transition in comparison with all windows.
3.4 Advantages and Disadvantages
3.4.1 Non Band limited Windows
With traditional nonband limited windows, based on Figure
3.73.13 digital filter designers primarily choose a certain window that
meets the requirements for the stopband attenuation and passband ripple
which are very much constant for each window as N varies. Then vary the
number of coefficients to obtain required transition region.
Therefore,nonband limited windows are useful if the length of window is
not of concern. If the length of window is a concern, that is a certain number
of coefficients is specified in the design along with required ripple, and
transition, there might be a problem of finding a window that meets the
design specifications.
3.4.2 Band limited Windows
With band limited windows, digital filter designers do not have to
choose a certain window primarily to meet the required ripple. As
mentioned before, the ripple and transition region can vary simultaneously
with N varying. Therefore, there are number of windows,which can meet the
requirements of ripple and transition region by only varying N. If the number
of coefficients N is a concern such as a certain number of window
coefficients is required in the design along with required ripple, transition
48
region, that is when a certain window may be advantageous. There is
another advantage of band limited windows namely that the bandwidth of
the windows can also be varied to add more flexibility to the design,
because the width of the transition region can be varied independently,
Figures 3.233.24.
Figure 3.23: Ripple and transition region Sine window of N =15
with bandwidth varying.
49
Figure 3.24: Ripple and transition region of Sine window of N=25
with bandwidth varying.
The following example will illustrate the advantages and
disadvantages of band limited and non* band limited windows. For
instance, in designing a filter which requires passband ripple < 0.8 dB,
stopband attenuation > 20 dB, transition region AF < 50 Hz.
Based on Figure 3.143.20 of band limited windows, some of the windows
can meet these specifications. The following Table 3.1 shows windows that
satisfy the requirements with the number of coefficients.
50
window # of coefficients,N
sine 15 < N
sine squared 18 < N
Inverse Von Hann 18 < N
Inverse Von Hann Squared 13
Table 3.1: The list of band limited windows that satisfy the
required specifications with the number of coefficients.
With non band limited windows, the window has to be searched
first for the required ripple. Searching through ail of the plots of Figure
3.73.13, only Von Hann square window that meets these specifications with
N > 27. Also in this case, if number of coefficients N is a specified design
factor such as N < 20, there is not a non band imited window that satisfies
these design conditions. While there are a number of band limited windows
can be selected in designing this filter, Table 3.1. Going through all the
provided plots of Figures 3.7 3.20 we see that the Inverse Von Hann
squared band limited window is the "best" window of all, since it gives the
largest stopband attenuation, smallest passband ripple, relatively smallest
transition region. With the non band limited windows, it is difficult to
determine which is better. For instance, the rectangular gives smaller
transition, but larger ripple, while the Von Hann or Hamming give smaller
ripple but wider transition. However, compared with all windows of its kind,
Von Hann is relatively a good window of the nonband limited ones.
CHAPTER IV
DISCUSSION AND CONCLUSIONS
As we know, an ideal lowpass spectrum is impossible since this
would require an infinitely long window. The necessity of using a finite
number of terms in the filter causes truncation error in the frequency
response. Truncation error generates the ripple and transition region in the
actual filter response. The windowing process is introduced to mitigate this
effect.
To study the effect of each window function, a program was written,
based on a prototype low pass filter. With this program, digital filter
designers can choose a window that meets requirements of passband
ripple, stopband attenuation, transition region and number of coefficients.
The program can plot the passband ripple, stopband attenuation and
transition region versus the number of coefficients or versus the bandwidth
of any window.
In the case of a band limited window function, the program can plot
the ripple and transition region of each window with the number of
coefficients of window (N) fixed and bandwidth (B) of the window varied, or
the bandwidth of window fixed and the number of coefficients varied. In the
case of non band limited windows, the program plots the ripple and
transition region of each window with only number of coefficients varied,
since non band limited windows do not have bandwidth as a parameter.
52
Based on Figures 3.73.20, in general, ripple and transition region of most of
windows are not changing after a truncation point, that is, ripple and
transition region of a window are constant after a certain numbers of
coefficients.
In the case of band limited windows, ripple and transition region
are constant for truncation beyond the first zero crossing, except the Inverse
Von Hann Squared. Its transition region increases for truncation after the
first zero crossing truncated. This leads to conclusion that the maximum
width is the first zero crossing for all band limited windows, since there is no
points in having more coefficients if the ripple and transition region of a filter
are not changed dramatically by the addition of more terms. Therefore,
through the search for new windows which are band limited, the Inverse Von
Hann Squared was found to be the "best" of all, assuming truncation at the
first zero crossing, since it gives the smallest ripple and narrowest transition
region with the same number of coefficients.
In the case of the Raised cosine window, the bandwidth of this
window has two parameters (Table2), B and f1 Therefore if f1 varies as a
function of B such that f1/B is constant, then each ratio f1/B gives a different
Raised Cosine window. Each Raised Cosine window has a certain ripple
and transition region. Therefore, the Raised Cosine window really
represents a selection of windows.
In the case of varying the number of coefficients all the windows
perform as expected, as greater the number of coefficients gives narrower
transition region, smaller ripple and some windows give better results than
the others. However, with a very small number of coefficients, all band
limited windows act very much the same. They give almost the same values
53
of ripple and transition region as the rectangular window. The performance
improves as the number of coefficients increases up to the first zero
crossing. Beyond that point the ripple and transition region do not improve.
It is an advantage of band limited windows that the bandwidth B and
the number of coefficients N are independent.
From Chapter III, we also see that band limited window functions
have more advantages than non band imited ones, since the band limited
windows are more flexible in selections. In other words, with the set of
specifications of ripple, transition region, the length of the filter, several band
limited windows can satisfy these requirements. On the other hand, with
non band limited windows, none of them may satisfy this set of
requirements. The reason for band limited window functions to work better
is that they have no sidelobes in their spectra theoretically. The sidelobes,
which are proportional to the ripple, are generated only because of the
truncation error. While non band limited window functions themselves have
some sibelobes in their spectra, the truncation error makes the sidelobes
worse. The worsened sidelobes leads to the worse ripple.
54
BIBLIOGRAPHY
1. Leon W. Couch, Digial and Analog Communication Systems, MacMillan,
NY, 1983, pp.301303.
2. C.S. Williams,Designing Digital Filters, PrenticeHall, New Jersey, 1986,
pp.97120.
3. Ronald N. Bracewell, The Fourier Transform and Its Applications,
McGrawHill, 1978, pp.159163.
4. Fredric J. Harris, "On the use of Windows for Harmonic Analysis with the
Diverse Fourier Transform", Proceedings of the IEEE, Vol. 66, No. 1, January
1988, pp.57.
5. R.L. Burden and J.D. Faires, Numerical Analysis, Prindle, Weber and
Schmidt, Boston, 1985, pp.4243.
6. R.W. Hamming, Digital Filters, Englewood. Cliffs, New Jersey,
PrenticeHall, 1983, pp.90115.
55
APPENDIX A
This appendix contains the program listing (named NB) to calculate
the passband ripple, the stopband attenuation, the transition region of all
window functions and plot them on the same graph versus the number of
coefficients or the bandwidth of the window.
56
i var i ed favariec i
au(50), , 3? < uft , aB(50)
bL (50). . b? . dB'50; , t:9 1 Slv
c 6 :50). , c? (5j?W , cB(50) , c? Si.'
d6'50!. .d?(50), dB'50)
key off
defdbl ar
dim a0(5(i>) a] (50) a2(50) at (50) a4 (50). a5 (50)
di tr. bi? !5'7> bl <50!,b2 (50! ,b3(50) b4 (50) b5'50!
dim c0 <50 > c 1 150) c2 (50! c~ (50; c4 (50) c5 50 i
dim d0(50).d:(50),d2(50),d7(50),d4(50),d5(50).
dim w<30)
print"if you want to plot passband, stopband. t r a.ns i 11 on vs bandwidth",
print"of band limited windows only,enter B7AR. 1J you want to plot vs ",
print"the coefficient numbers or anything else such as magnitude or dE".
print"o( a certain window with a certain bandwidth or coef i c i ent s ent er H ,'Ar' .
input "enter BVAF: or N'v'AR = ",nb4
if nbS="tvar" then gosub bvariec
i f np*='nvar" then gosub nvaried
end
nvaried:
wi .1 ) = "Sinc squared":w*(2>="1nverse for, Hanr," : wS
wt (4: = In ver se Hammi ng w (5 = 1 n yer se Von Hanr. squared"
wS (6 i ="Rai sed cosine f 1 = 1 /1 Pb : wt (7) = "Rai ser cosine f1=7/10b"
w*(8)="Raised cosine f 1 = 1 /2b : wt' 9! = Rai sed cosine fl=710b"
wt (10) = "Raised cosine fl=9/10b"
wt (1 1) ="Rectangul ar ": wt (12) = "Hammi nc": wt (17) = "Tr i anaul ar : wt (14) = "Vor. Hanr.'
wt(l5)=Von Hann squared":wt(16)="Hamming squaredwt(17!=")aiser"
wt(12)="Normal":wt!19)="1nverse )aiserwt(20>="Inyerse Hamming Squared"
pr i nt "Sel ect l one of windows: "
for i = l to 20
print i,wt(i)
ne::t 1
input"input only the number for which.the window to be used, s = ",s
inpuf'input the sample rate fs = ", f s
input"specif/ # of points to be calculated from 0 to fs/2 (at least 1000) = ".nc
inpuf'input bandw:th of the filter = ".b
input"input bandwsth of the window = ",bw
pr i nt "REMEMBEF: input tne same number for n = tart and m (ignore division by 10)"
prinfto plot only magnitude or dB plot of a certain 4 of coefficients"
prinfand if window is triangular nstart and m should not. be multiple of 5"
prinfsince program can not determine f2"
inpuf'input # of coefficients to start to plot from nstart = ".nstart
inpuf'input total # of coefficients (divisible by 10) to be plotted m = ",m
if nstart=mi then inpuf'enter 1 for magnitude plot or dB plot ",mag
inpuf'input ft of iterations = ",n
dim c(m),h(m),w(m>,amp(npoi nt + 1),f(npoi nt+1>,pbr(m>,sba(m),delf(m)
dim mag(m),a(m)
pi =4*atn (I)
if s=13 then a*="yes"
for l:=nstart to m
if s=l then gosub coefficients!
if s=2 then gosub coefficients2
if s=3 then gosub coefflcients3
if s=4 then gosub coefficients4
if s=5 then gosub coefficientsS
if s=6 then gosub coefficients6
if s=7 then gosub coefficients?
if s=B then gosub coefficientsS
if s=9 then gosub coefficients9
if s=10 then gosub coefficintsl0
if s=ll then gosub coefficientsl1
if s=12 then gosub coefficients!2
LI 111 U
57
if 5=13 then gosub mul t i chec 1.:: gosub
i f S=14 then gosub coef f i cients1 A
i f 5=15 then gosub coef f i c.1 ents 15
if S= 16 then gosub coeffi cients1 &
if 5=17 then gosub coeff i cientsl7
l f 5= 1 B then gosub coetficientslB
if s=l then gosub coefficient 519
if S=20 then gosub coef f i clents20
gosub pointplotted
gosub curve
gosub passband
gosub stopband
gosub transition
if mag=l then gosub magdB
ne::t t
cdeH i ci ent s 1 ..
it nstart=m then return
gosub ggetl
gosub getplots
gosub plots
return
rem to do the magplot subroutine or dBplct subroutine
magdB:
gosub getmag:gosub magplot
locate 1,20:print"hit any bey tor dp plot":
22 it inkey*="" then goto 22
gosub getdbtgosub dbp1ot:gosub putdb
return
mul ti check::
tor i = l to int(m/5)
a(i > =i *5
next i
tor i=l to int(m/5)
it nstart=a(i) then pbr (nstart) =0: sba (nstart) =0: del f (nstart) =(?
next i
return
rem sine squared coetticient valup5*************
coetticientsl:
c<0> =2*b/fs
w(0)=l
h(0)=c<0)*w(0)
for i = l to I;
tc=2*pi*b/fs
c(i >=c(0>*(sin(tc*i))/(tc*i)
w(i)=((sin(pi*bw*i/fs)> / (pi *bw*i/ts))'2
h (i ) =c (i) *w (i >
next i
return
rem Inversed Von Hann window************************************************
coetficients2:
c(0)=2*b/fs
w(0>=l
h(0>=c(0)*w(0)
for i=l to k
tc=2*pi*b/fs
c (i ) =c <01 (Bin (tc*i 1 > / (tc*i >
aa=(sin(2*pi *bw*i/fs))/(2*pi *bw*i/fs)
bb=l((2*bw*i/fs>~2>
if abs(bb)<0.00001 then w(i)=(.5):goto 2
w< i> = (aa/bb)
2 h (i ) =c (i ) *w(i )
next i
return
rem Sine
coetti cients"
c (0) =2*b/tE
w(0)=l
h !0>=c ((?) (0)
tor i = l to 1.
tc=2*pi b /1 e
c(i>=c(0)*)/(tci )
w i ) = (sin 2*pi *bw*i / ts> ) / (2*pi *bw* 1 /f s !
h(i)=c(i)*w(i
nest l
return
rem Inversed Hamming coett i ci ents val ues***> ***
coetticient 54:
ca=.54
cb=.46
c (0>=2*b'ts
w (0)=2*ca
h <0)=c(0)*w(0>
tor i = l to I'
tc=2*pi*b/tE
c(i)=c(0>*(sin(tc*i))/(tc*i)
aa=(si n(2*pi *bw*i/t s))/(2*pi*tw*i/ts)
bb= ( (2*bw*i / t 5> "2) 1
cc=2* ( ( (2*bw*i /f e) 2)*(cacb>ca!
it abs !bb)<0.00001 then w(i)=cb:goto
w (i ) = (aa*cc/bb )
4 h (i ) =c (i ) *w (i )
nest i
return
rem Inversed Von Hann
coe
c (0) =2*b/t 5
W(0>=1
h(0)=c(0)*w<0>
tor i = 1 to 1:
tc=2*pi*b/ts
c (i )=c (0) (sin (tc*i ) ) / (tc*i )
aa=(sin (2*pi *bw*i/ts))/(2*pi*bw*i/ts)
bb=l((2*bw*i/ts)"2)
it abs(bb)<0.00001 then w(i)=(.5)"2:goto S
w (i > = (aa/bb > '"2
5 h(i)=c(i)*w(i)
next l
return
rem Raised Cosine 11 = 1 / 10b***************************
coett i ci entsb:
c(0)=2*b/t s
w(0)=l
h(0)=c(0)*w(0)
tor i=l to k
tc=2*pi *b/ts
c/(tc*i)
xx=(bw(1/10)*bw)*i/ts
aa=(si n(pi *(bw+1*bw/10)*i/ts))/(pi*(bw+1*bw/10)*i/t s)
cc=l( (2*xx),'2)
bb=cos (pi *>:x)
it abs(cc)<0.00001 then w(i)aa*pi/4:goto 6
59
w i >=(aabb/cp> '2
6 h(i)=c!i)*w i;!
r.e::t i
return
ren. Raised Cosine +1=7.
c oe + +icierts?:
c !0 =2*b.'+ s
w <0; = 1
n (C*i > =c (0 1 *w < 0:
tor i=l to \
tc=2*pi b + s
z (i ) =c (0 (sl r. (t c *i > > i
(bw 7 / 10) *bw *l + !
aa= . si n ip: !bw7*bw/10
CC=l( ( 2*..:: I1 2 )
bb=co= (pi*;:::)
l + abs f ct) ,0.00001 then w ti ) =aa*pi '4: got c
w!l>=(aa*bt/cc! "2
7 h (l )=c li *w (i
nent i
'.tc*i
'1/+S ) (pi 'bln* 7*bw.
+ s>
r eturn
ren. Raised Cosine + 1 = 1 /2b******* = ****** *
coe+ +icients8:
c(0>=2*Â£/+s
w(0)=l
h (0 =c (0.1 w (0)
tor i=l to k
tc=2*pi*t>/ + s
c (i )=c (0) (sin (t c l ) ) / (tci )
i:= (bw (1 /2) *bw) *1 / + s
aa= (sin (pi (bw* 1 *bw.'2) *i .' + s! ) / (pi (bw*l*bw'2)*i / + s)
cc=l( (2*s:.;> 2)
bb = cos (pi )
it abs(cc> 0.00001 then w (i)=aa*pi/4:gGtc B
w(i) = (aa*bb/cc) "2
B h(i>=c(i)*w fi>
ne::t i
return
ren. Raised Cosine +1=7
coe+ + ic i ents9:
c (0)=2*b/+s
w(0)=1
h (0) =c (0)*w(0)
+ori=ltok
tc=2*pi*b/+s
c(i>=c(0)*(sin(tc*i!)/(tc*i)
>:>:= (bw (7/10) bw) *i /+s
aa=(sin(pi* (bw+7*bw/ 10)*i/+s))/(pi*(bw*7*bw10)i' + s)
cc = l( (2*::i:>/'2>
bb=cos (pi *>:i:)
i+ abs(cc)<0.00001 then w(i)=aa*pi/4:goto 9
w (i ) = (aa*bb/cc > 2
9 h (i ) =c (i ) *w (i )
next i
return
rem Raised Cosine +1=9/
coef + ici entsi 01
c(0>=2*b/+s
w(0)=l
h(0)=c(0)*w(0)
for i = l to k
tc=2*pi*b/fs
c(i)=c(0)*(sin(tc*i))/(tc*i)
>:>: = (bw(9/10)*bw)*i /fs
aa= (si n (pi (bw+9#bw/ 10>*i/fs))/(pi(bw,9*bw/10>*i/fs>
cc=l( (2*x>s)A2>
bb=cos (pi *xx)
if abs (cc) <0. 00001 then w (i ) =aa*pi/4: goto 10
w (l ) = laa*bb/cc) 2
10 h (i)=c(i > *w < i)
next i
return
rem rectangul ar*********+******+******++ + *******+******
coef f l ci ent si 1:
c (0) =2*b/fs
m(0)=1
h(0)=c(0)*w(0)
for i=l to k
tc=2*pi*b/fs
c(i)=c(0)*
w (i ) = 1
h (i ) =c (i ) *w (i )
next i
return
rem Hammi ng************************************************
coef f i ci entsl2:
ca=.54
cb=.46
c(0)=2*b/fs
w(0)=l
h (0) =c (0) *w (0)
for i=l to k
tc=2*pi*b/fs
c(i>=c(0>*(sin/(tc*i)
w(i)=ca+cb*cos(pi *i/k >
h (i ) =c (i > *w (i )
next i
return
rem tri angular******************************************
coefficientsl3:
c<0>=2*b/fs
w(0)=l
h(0)=c(0)*w(0>
for i=l to k
tc=2*pi*b/fs
c (i ) =c (0) (sin (tc*i > > / (tc*i >
w(i > = li/k
h (i > =c (i > *w (i >
next i
return
rem Von Hann******************************************
coefficientsl4:
c(0)=2*b/fs
w(0)=1
h (0) =c (0) *m (0)
for i=l to k
tc=2#pi*b/fs
c(i)=c(0>*(sin(tc*i>>/(tc*i)
w (i) = .5+.5*cos(pi*i/k)
h (i ) =c (i ) *w (i >
61
next i
return
rem von hann squar ed****************** # *+ + *+++ + *******+
coef f i ci enta 15:
c (0) = 2*b/f 5
w (0 > = 1
h(0)=c<0>*w<0)
for i = 1 to k
tc=2*pi *b/f s
c(i)=c(0>*(sin!tc*i!)/(tc*i)
w(i)=(.5+.5*005(pi*i/k))'2
h(i)=c (i )*w (i)
next i
return
rem Hamming Equared***********************************4******
coef f i ci entsl6:
ca=.54
cb=.46
c(0)=2*b/f s
m (0 > = 1
h(0)=c(0)*w(0)
for i = l to I.
tc=2*pi *b/f s
c (i) =c(0>*(sin(tc*i))/ (tc*i)
w(i>=(ca+cb*costpi*i/k)!2
h(i)=c < i)*w (i >
next i
return
rem kai ser ***************************************
coefflci ents17:
c(0)=2*b/fs
w(0)=l
h(0)=c(0)*w (0)
alfa=.1
for i = l to k
tc=2*pi*b/fs
c
zz=alf a* (sqr C1(i/k) " 2) > :ti=zz/3.75:ta=alfa/3.75
al=3.5156229:a2=3.0B99424:a3=l.2067492:a4=.2659732:a5=.0360768:a6=.0045S1"
ii=l+(al*ti~2)+* + +
i af = 1+ (al*ta2)+ (a2*ta"'4) + (a3*ta"'6) + Ca4*taB) + (a5*ta~10) + (a6*ta'"12)
w (i ) =i i /i af
h (i > =c (i ) *w (i )
next i
return
rem normal******************************************
coefficientslB:
ca100
c(0)=2*b/fs
w(0)=l
h<0)=c(0>*w(0)
for i = l to k.
tc=2*pi*b/fs
c
w (i ) =exp <ca* (i /f s) y'2>
h
next i
return
rem inverse kaiser window**********************************************
coefficientsl9:
62
S1f S=. 1
c ((?) =2b /f s
w (0) = (exp (alfa)exp(alfa) )/(2*alfa)
h(0)=c(0)*w(0)
for i = l to k
tc=2*pi *b/f s
c(i>=c<0)*(sin/(tc*i)
aak = < <2*pi *bw*i /f s) "2) (al f a) '"2
if aak=0 then w(i)=l'
if aak .0 then yi =sqr (abs (aak ) : w (i = (e p yi )exp yi > > / (2*yi )
if aak>0 then saal=sqr(aak):w!l)=(sin(saak;)/seat
h < i =c (l *w < i J
ne:;t i
return
rem Inversed Hamming squared coefficients valU6i*******************
coef f i cients20:
ca=.54
cb=.46
c(0>=2*b/fs
w(0)=2*ca
h(0)=c <0> *w(0)
for i=l to k
tc=2*pi*b'fs
c
aa=(sin(2*pi*bw*i/fs))/<2*pi *bw*i/f e>
bb= ( (2*bwi /fs) ~2> 1
cc=2* ( < (2*bw*i/f s) 2) (cacb) ca)
if abs
w (i ) = (aa*cc/bb ) "2
20 h (l ) =c (i ) *w (i )
next i
return
rem amplitude points to be piotted*********************************
poi ntplotted:
tl=2*pi/fs
wt=0
del=(fs/2)/npoint
for i=l to npoint+1
aamp=h(0)
for j=l to k
fk=tl*wt*j
c=cos(fk)
aamp=aamp+2*h(j)*c
next j
amp (i ) =abs (aamp)
f(i)=wt
wt=wt+del
dummy=amp
if <0)) then pmid=i
next i
return
rem to check when it starts to go down*****************************
curve:
for i= pmid to 1 step 1
if amp(i)<=amp(i+1) then pturn=i+l ireturn
pturn=i
next i
return
rem to determine amax,amin,then passband ************************
passband:
re m deter mi ne amax **+******+*****+***++* *+********+*
max=amp (1)
far i = l to npoint+1
if amp (1 ) /=ma:: then max=amp (i ) : pmax = 1 : temppn.a.
next i
gosut newton
fmax=p
gosub amplitude
amax=a
rem deter mi ne ami n+*** a********************************************
min=amp(1)
for i=l to pturn
if amp'.i). =min then mi n=amp (l ): pmi n=i : tenp=pmi r.
ne:: t i
gosub newton
f min=p
gosub amplitude
ami n=a
rem determine passband rippl Â£>++***** + ***+*********
r=amax/amin
pbr (h)=20*1 og ir /I og (10)
return
rem newton met hod***********"******* a********************** **
newton:
po=f(temp)
i = 1
while.i<=n
hf =0
hfp=0
for j=l tol
ss=sin(j*t1*po>
hf=hf+h(j)*ss*j
cc=cos(j*tl*po!
hfp=hfp+(j''2)*cc*h(j)tl
next j
p=pohf/hfp
if abs(ppo!<10"(9) then i=n
po=p
i=i +1
wend
return
rem to calculate amplitude for particular frequencyf****t****
ampli tude:
a=h(0)
for j=l to k
cc=cos(j*tl*p)
a=a+2*h(j)*cc
next j
a=abs(a)
return
rem to determine maximum magnitude in stopband region**************
stopband:
smax=amp(pmid)
for i=pmid+l tD npoint+1
if amp (i ) >=smax goto stopmax
smax=amp(i)
nex t i
stopmax:
smax=amp (i ) : psmax=i : temp=psma>:
for j=i + l to npoint + 1
64
if amp(j)'=smax then smax=amp (j ) : psmax = j : temp=psnis:
next j
gosub newton
f smax=p
gosub amplitude
asmax=a
sba (k) =20*1 og (asmax) /I og 10)
return
rem to determine fl and <2 for transition region del f**************
transition:
rem to determine f1+***+++*++*++**+++**+*+++*++++**+*******+*++
f di f =f smax f (pturn!
f del = f di f / (fs.'2>
for i = I to fs/2
atest=h(0)
ftest=f (pturn) +f del *( i1)
for j=l to k
ctest=cos (j*tl*ftest)
atest=atest+2+h(j)*ctest
next j
ate5t=abs(atest!
if atestamin then f l = f testf del : nn=i : got o asmsxtest
next i
rem to determine f2*****+******+*+**+*+*****+++++*******++*+*++****
asmaxtest: ,
for i=nn to fs/2 +100
atest=h(0)
ftest=f(pturn)+fdel*(l1)
for j = l to l,
ctest=co5(j*tl*ftest)
atest=atest+2+h(j)*ctest
next j
atest=abs(atest)
if atestasmax then f2=f testdel : goto getout
next i
getout:
delf(k)=f2f 1
return
rem magnitude plot for each 4 of coefficients**********************
magplott
screen 2
els
1ine(40,20)<40,180)
1ine(40,180)(630,1B0)
1=1S1/10
put(10,1781),b1,o+put(10,1782*1),b2.or:put(10.17e3*l),b3.or:put(10.1734*1 ).
put(10,1785*1),b5,or:put(10,1786*1),b6,or:put(10.1787*1),b7,or
put (10, 1788*1) ,b8, or:put (10, 1789*1 > ,b9. or: put (10, 17.810*1 ) ,bl0, or
1=561/10
put(24,1B3),a0,or:put(30+1,183).al,or:put(35+2*1,183),a2,or:put(75+3*1,1B3).a3.c
put(35+4*1,183),a4,or:put(35+5*1,183),a5,or:put(35+6*1,1B3),a6,or
put <35+7*1,183),a7,or:put(40+8*1,1B3),aB,or:put(40+9*1,183),a9,or
put(40+10*1,183),al0,or
for i=30 to 180 step 15
pset(39,i):pset(41,i)
next i
for i=9B to 620 step 58
pset(i,181):pset(i,179)
next i
for i=l to npoint+1
65
amp (i ) = amp (1 ) 1 Si?.' 1
next 1
for 1 = 1 to npoint
pt=nooiot*1
I : ne 40+580+ <) 1 ) /pt 1 S'.;1 amp i ) .405B0* : /pt, 1 B0amp l + 1 ) !
RE::t 1
::=5Bi?/ (fs/2) : r = 150/ 1
1 i ne 140+f 2*;:. 180asmax r (580, 1 80asma r '
1 i ne (40+f smax +.., 1 El;1 am: nr 1 <40, 1 Si;' ami n + r >
line! 40+f 1 *x 180 ami n + ; > < 4i? + f 1 :: 1 BP)
J i ne (40+f 2*:., 1 90) :40+ f 2*x 1 80ami n*c )
1) ne (40. lB0amax*: ? (40+f smax*.., 1 80amax*r )
locate 25.1: pr i nt "Magn i t Lide plot of :w3 = ; window" :
print" with number coefficient n =";t:""s
locate 24, oB: print "frequency":
locate 2,4:print"Magnitude
locate 10.50: pr i nt "paesband ripple = :pnr.t usi ng "4. tMttt" ; pbr 11 ) : : pr i nt "c'f' :
locate 11,50: prjnt"stopband = ";:print using "###.#44abs sbaU !);:orir.t"cF i
locate 12,50: pr i nt tr ansi 11 on r egi on : : : pr i nt f 1 = : : pr i nt usi ng"###. ###": : : : pr
1 ocate 13,50: print" "::print"f2="(Sprint using "###.##(1 ; f 2 :: p
return
rem plots of passband, stopbar.d, transition region nvaried**t******
piots:
screen 2
cl s
window <0,0)(639,199)
1 ine.20.30)(620,30) . '
line(40.30)<40,190)
1i ne(600,30)(600.190)
1=561/10
put(24,25,aP,or:put(28+1,25),a 1,or:put :282+1,25),a2,or:put(2B+3+1.25).a3.or
put (28+4+1,25! a4, or: put (28+5+1.25) ,'a5, or : put !2B+6+1,25) a6. or
put(20+7*1,25),a7,or:put(2S+S+1.25),a8,cr:put(28+9*1,25),a9,or
put(28+10+1,25).al0,or
1=151/10
put(610,31+1).b1,Dr:put(610,31+2+1!,P2,or:put(610,31+3*1),b3,or:put(610,31+4*1),
put(610,31+5*1),b5,or:put(610.31+6+1i,b6,or:put(610,31+7*1),b7,or
put (610,31+8*1 ) bB, or: put (61 0, 3.1 +9*1 ) b9. or: put (610, 31 + 10*1 ) b 10, or
1=151/10
put(10,31+1),cl,or:put(10,31+2*1),c2,or:put(10,31+3*1),c3,or:put(10.31+4*1),c4,c
put(10,31+5*1),c5,or:put(10,31+6*1),c6,or:put(10,31+7*1),c7,or
put(10,31+B*1),cB.or:put(10,31+9*1),c9,or:put(10,31+10*1),cl0,or
1=151/10
put(55,31+1),dl,or:put(55,31+2*1),d2,or:put(55,31+3*1>,d3,or:put(55,31+4+1),d4,c
put(55,31+5*1),d5,or:put(55,31+6*1).d6.or:put(55.31+7*1),d7.or
put(55,31+B*1),dB,or:put(55,31+9*1),d9,or:put(55,31+10*1),dl0,or
for i=30 to 1B0 step 15
pset(39,i):pset(41,i! :pset(601,i):pset(599,i):pset(49,i):pset(51,i'
next i
for i=0 to m step m/10
pset(40+560*1/m,29):pset <40+560*i/m,31)
next i
for i=nstart to m
checl:=l
if a="yes" and i=a(int(i/5>) then mag(i)=0 else mag(i)=pbr fit)*150/pbma;:
next i
gosub drawline
for i=nstart to m
check=2
if a*="yes" and i=a(int(i/5)) then mag(i)=0 else mag(i)=abs(sba(i))*150/sbmax
66
next i
gosub drawline
for i=nÂ£tart to m
checf=3
if a*="yes"and i=a(int(i/5)) then mag(i;=i? else mag 1 ) =del f 1 i ) 1 50'dma.
next i
gosub drawline
locate 24,1: print"Plots of (1) : passbar.d ripple i r. dB: C2):stopband at ter ,i*t: c
print"!3):transition region in H; versus n with "iwtis);" window used":
locate 1,2: print"i3)"i: locate 1, B: pri nt"(2)":1Dcate 1,77: pr 1 nt 1 :
return
drawline:
x11=40+560*!nstart+1>/m:y11=30+mag(nstart+1)
x22=40+560* instart)/m:y22=30+mag instart)
if mag instart) =0 then preset (:: 1 1, yl 1): gosub pput
if mag instart) >0 then preset (>:22, y22> : gosub pput
for i=nstart+l to m
if magii)>0 then 1ine(40+560*(i)/m,30+mag(i)>
if mag(i)<=P then gosub dottedline
next i
return
dottedl l ne:
if i=m then return
x2=40+560* i i +1)/m:x1=40+560+ < i 1)/m: y2=30+mag! l +1 : yl=30+mag(i 1 )
m 1 =(y2y1>/(x 2x1>
b=ylml*xl
for ii=il to i+1 step 1/5
X=40+560*1 i ,'m
y=ml*x+b
pset(x,y)
next ii
return
gget 1:
dim one(10),two(10),threei 10)
screen 2
els
print"1"
get i0,0)(20,10), one
els
print"2"
get <0,0)(20,10),two
els
print"3"
get(0,0)(20,10),three
els
return
rem get the axises for magnitude plot*********************************
getmag:
screen 2
els 1 =0 print usi ng ;(fs/2)*1/10:geti0,0) (25,10),a0:cls
print 1=1 + 1 using ;1*1/10:get(0,0)(25, 10),b0:cis
print using ;ifs/2>*l/l0:get(0,0) (25,10),al:cls
print using ;1*1/10:get(0,0)(25, 10),bi:cls
1=1+1 print using f(fb/2)*1/10:get(0,0) (25,10),a2:cls
print 1=1 + 1 using 51*1/10:get(0,0)(25, 10),b2:cls
print usi ng "44 44*4 " :
print 1=1+1 us i ng "#.44" ;1*1/10:get(0,0)(25, 10).b~:cis
print usi ng "##44" ; (f s/2) *1 /10: get (0.0) (25.10),a4:cls
print 1=1 + 1 usi ng "#.#" ;1*1/10:get(0,0)(25. 10),b4:c1s
print using "###" 4 (fs/2)+l/10:get(0,0)  (25, 10),a5:cls
print 1=1+1 using "#.#" ;1*1/10:get(0,0)(25. 10).b 5:c1s
pr i nt using "###" ;(fs/2)*1/10:get(0,0) (25.10),a&:els
print 1 = 1 + 1 usi ng "#. #" ;1*1/10:get(0,0)(25. 10),b6:cls
print usi ng "###" !(fs/2)*l/10:aet(0,0) (25,10),s7:cls
print 1 = 1+1 using "#. #" :1*1/10:get(0,0)(25, 10),b7:cls
print usi ng "###" ; (fs/2)*1/10:get (0, 0) (25. 10).a8:cls
print 1=1+1 using "#.#" ; 1*1 /10:get(0,0)(25, 10),bB:cls
print using "###" ; (fs/2)*l/10:get(0,0) (25,10),a9:cls
print 1=1 + 1 usi ng "#.#" ;1*1/10:get(0.0>(25, 10),b9:c1=
print usi ng "###" : (f s/2) *1 /10: get (0.0) (25,16).al0:cls
print using return ; 1*1/10: get (0,i3)(25, 10),b10:c15
rem get axises for all the db plots of the curves with
getplots!
pbma>:=pbr (nstart) : sbma>; = abs (sba(nstart) ) : dmax=del f (nstart)
for i=nstart to m
if pbr(i>>=pbmax then pbmax=pbr(i)
if abs (sba (i ) ) >=sbmax then sbmax=abs (sba (i ) )
if del f (i ) '=dmax then dma.:=del f (i )
next i
pbmax=cei1(pbmax)
sbmax=l 0*cei 1 (sbrnax / 10)
dmax=10*cei1(dmax/10>
screen 2
els
1*0
print using
print using
print using
print using
1=1 + 1
print using
print using
print using
print using
1=1 + 1
"##" !m*l/10:get(0.0)(25, 10.' ,a0:cls
"44.#";.pbmax*l/10:get(0,0>(25, 10) .b0:cls
"###";dmax*l/10:get(0,0)(25,10),c0:cls
"###";sbmax*l/10:get(0,0)(25,10),d0:cls
"44#" 5 m*l /10:get(0,0)(25,10),al:cls
#.#"; pbmax*1 /10: get (0, 0) (25, 10) b 1: cl s
"4(4*44";dmax*l /10:get (0,0)(25.10),cl:els
"###";sbmax*l/10:get <0, 0) (25, 10), dl: cl s
print using
print using
print using
print using
1 = 1 + 1
"4(4("; m*l /10: get (0,0)(25, 10) ,a2:cls
"#.#";pbmax*l/10: get (0,0) (25, 10) ,b2:cls
"###";dma>:*l/10:get (0,0)(25, 10) ,c2:cls
"###"(sbmax*l/10:get(0,0)(25,10),d2:cls
print using
print using
print using
print using
1 = 1 + 1
"4444 "1(11*1/10: get (0,0)(25, 10) ,a3:cls
44 44 t pbm*>:*l /10: get (0,0)(25, 10) ,b3:cls
"#4444" {dmax*I /10: get (0,0>(25, 10) ,c3:cls
"###"5sbmax*l /10:get (0,0)(25, 10) ,d3:cls
print using "44" f m*l/10: get (0,0) (50,10), a4: cl s
print using 41.44" t pbmax*l/10: get (0,0) (25, 10) b4: cl s
print usi ng
pr l nt 1=1+1 using "###
pri nt usi ng
pr i nt usi ng
pri nt using
pri nt 1 = 1 + 1 using
pri nt using
pr i nt usi ng
pri r.t usi ng
pri nt 1=1 + 1 usi ng ###
print usi ng
pr: nt using "P. #
pr i nt using
print 1 = 1+1 usi ng "###
print using
pri nt usi ng
pr l nt using
print 1=1+1 usi ng "###
pri nt using
print using
print using
print usi ng
1 = 1 + 1
print using
print using
print usi ng
print usi ng
return
em put val ue f or
10:
. c4:c1s
10). at.: c 1 5
(25,10) ,b5: C} Â£
'25.10:. n C.1 n i
 25, 11? . d5: cl Â£
10) a ii : cl y.
(25,10 ,bb: cl Â£
(25.10 . cite
(25.10) . di: cl S
#. # S pbmax+1 /10: get (0,0.'
### : dma:: 1 / 10: get (0,0)
"###' J sbma::*l / 10: get (0, 01
###" i dma::+l / 10: get (0, 0) 
###" i sbmax*l /10: get (0,0)
: m+1 .'10: get (0. 0) <25. 10 / a7: c 1 s
" i pbmax*l10: get (0. 0) (25, 10> b7: c 1 s
" ; dmax*l /10: get <0,0)<25, 10) ,c7:cls
"i sbmax*l/10:get(0,0)(25.10),d7:cls
iml/10 : get(0,0)(25,10!.a3 : c 1 =
" : pbma>: *1 / 10: get (0,0,' (25, 10) bE: c 1 e
" i dma;:H / 10: get (0,0) (25. 10) cB: c 1 e
" ; sbmax 1 /10: get (0,0)(25. 10) ,dB:cle
:m*l /10:get(0,0)(25.10),a9:cle
" ; pbmax*l / 10: get (0, 0) (25, 10) bQ; cl e
" > dma::*1 / 10: get (0,0) (25, 10) c9:c1s
m*l /10: get <0,0) <25, 10) a.1 0: c 1 s
'ipbma>:*l/10:get (0,0) (25. 10) ,bl0:cls
' i dmax *1 / 10: get (0,01 (25, 10! c 10: c 1 a
' i sbmax*1 /10: get (0.0) (25, 10) d 10: cl e
each curve of ripple and
PPut:
1+ mag (nstart) =0 and check=l then put (:: 1 1 yl 1 ) one, or
it mag (nstart) =0 and check=2 then put <:: 11, y 1 1 ) two, or
it mag (nstart! =0 and check=3 then put (:: 11,, 1 1 ), three, or
it mag (nstart )< >0 and check=l then put (x22, y22> one, or
it mag (nstart )< >0 and check=2 then put (::22, y22) two, or
it mag(nstart)<>0 and check=3 then put(x22,y22),three,Dr
return
rem db plot e***********************************************
dbplot:
pt=npoint+l
screen 2
els
xma>:=ts/2: >:min=0: ymax l = 10*ceil (yymax /10) : ymi n=l 0*i nt (yymi n/10)
xs=xmaxxmin:ys=ymaxymin
asmax=20*l ogl0 (asmax)
ami n=20*logl0(ami n)
amax=20*logl0(amax)
window (.2*xs+xmin,2*ys+ymin)(.2*xs+::max,.2*ys+ymax)
1ine (.l*xs+xmin,0)<.l*xs+xmax,0)
line(xmin,.l#ys+ymin)(xmin, l*ys+ymax)
tor x=>:min to xmax step (ts/2)/10
1ine(x,0.01*ys)(x,0+.01*ys)
next x
tor y=ymin to ymax step 10
1ine(xmin.00B*xs,y)(xmin+.00B*xs,y>
69
next y
for x = l to npoint
line
next >:
1 ine (xmin+f 2, ammax)
1ine
line (xmin+f 1,. l*ys+ymax ) (xmin+f 1,ymin)
line (xmi n+f 2, ymi n)
1 ine (xmi n, amax) (xmi n+f smax, amax)
locate 23,1: print"dB plot of 5w*(s)i" window" ;
print" with number coefficient n =";k;"S
locate 2,10:print"Magnitude "I
locate 21,15: print"passband ripple = "Slprint using"#.ft##";pbr (k)!:print"dB";
locate 22,13: print"stopband ";:print using"###.###"!abs(sba(k));:print"dB"1
locate 23,15: print"transition region:;:print"f1 = ";:print using"###.###":f1;:prir
locate 24,15: print" printf2=":print using"###.###";f2!:prir
locate 2,65:print"frequency"
return
re* get axises of db piota********************************************
getdb:
for i=l to npoint+1
amp(i)=20*1 eg 10(amp(i >*1/130)
next i
yymax=amp (1): yymin=amp (1) t
for i = l to npoint+1
if amp(i)>=yymax then yymax=amp(i)
if amp<=yymin then yymin=amp(i>
next i
ymax=10*ceil(yymax/10)
ymin=10*int(yymin/10)
"###";(fs/2)*l/10:get(0,0)(25,10),a0:cls
"##";ymax:get(0,0)(25,10),b0:cls
"###";(f5/2)*1/10:get<0,0><25,10>,al:cls
"##"iymax10 :get(0,0)(25,10),bl:cls
"###"!(fs/2)*1/10:get(0,0)(25,10!,a2:cls
"##"ymax20:get(0,0>(25,10),b2:cls
"###";(fs/2)*1/10:get(0,0)(25,10),a3:cls
"##"ymax30:get(0,0)(25,10),b3:cls
"###"J(fs/2)*1/10:get(0,0)(23,10),a4:cls
##1ymax40;get(0,0)(25,10),b4:els
"###"5(fs/2)*l/10:get(0,0>(25,10),a5:cls
'## I ymax50: get (0,0)(25,10) ,b5:cls
"###"((fs/2)*1/10:get(0,0)(25,10),a6:cls
"##"ymax60:get(0,0)<25,10),b6:cls
"##" (fs/2)*l/10:get(0,01125, 10) ,a7:cls
'##"ymax70:get (0,0><25,10) ,b7:cls
"###")(fs/2)*1/10:get(0,0)(25,10),aB:cls
##"jymaxB0:get <0,0>(23,10),bS:cls
screen 2
els
1=0
print using
print using
1=1+1
print using
print using
1 = 1 + 1
print using
print using
1=1 + 1
print using
print using
1 = 1 + 1
print using
print using
1=1 + 1
print using
print using
1=1 + 1
print using
print usimg
1=1+1.
print using
print using
1=1 + 1
print using
print using
70
pri nt usi ng "### " ; cfÂ£/ 2)*1/id: :get(0, , 0>  (25, 10) a9: c 1 e
pn nt USI ng * ymax 90:get (0,0) (25. 10), b9:cls
1=1 + 1
pri nt U53 ng ; (f 5 / 2) *3/10: :get(0, , 0)  (25. 10.' =10: c 1 e
pn nt US 1 ng ; ymax 100:get(0s 0)  (25 . 10> , b 10: c 1 e
ret urr r
re m put arises of db pi ot **********************************+
putdb:
l=>:s/10: 11=0+. 08*ys: 1 11 = 173*::s
put<>:min + l lll,ll),al,or:put<::min + 2*llll.ll),a2,or
put mi n+3*l 1 11 .11 ) a3, or:pLit(Kitiin+4*l111.12;,a4.or:put(>cmin + 5*1. 11:.11).=3. or
put <::mi n+6*l 111 ,11 ) a6, or: put (::mi n+7* 1 111 11 ) a?, or : put <::min+8*l 111,13 at?, or
put (smin+9l 111 ,11 ) a1?, or : put (>: mi r>+1 0* 1 111 1 1 ) a 10. or
1 = 10: 11 =. 03* ,s: 1 11 =. 0B*x e
if ymax* then put (>:minl 11 ymax+2*l 1 ) b0, or el se put (xmi n1 1 yms,,*I 1 ) b > r.
if if ymax10*0 then put (>:mi n11 1 yma* ymax10=ymin then return 10*2*11) b 1 or el =e put (: mi n 11 2 yma 20*11'
if if ymax200 then put (xmi n111, ymax ymax20=ymin then return 20+2*11!, b2, or else put (xmi n111, yma. 20*11
if if yms>:30=0 then put (xml n1 11 ymax ymax30=vmin then return 30+2*11). b3. or el se put (xmi n111 yma: 30+11
if if ymax40=0 then put(xmi n111,ymax ymax40=ymin then return 40+2*11!. b4 or el se put (x ms n 1 11 y ms: 40+11)
if if ymax50=0 then put(xmin111,ymax ymax50=ymin then return 50+2*11), t5, or el Ee put(xminlll.ymax 50+11)
if if ymax60*0 then put(xmin111,ymax ymax60=ymin then return 60+2*11), b6, or el se put (xmi n121 yma. 60+12)
if if ymax70=0 then put(xmln111,ymax ymax70=ymin then return 70+2*11!, b7, or el se put(xmin111 ,yma 70+11)
if if ymax90=0 then put(xmin111,ymax ymax90=ymin then return 90+2*111. b9, or el se put(xmin111 ymax 90+11)
if if ymax80*0 then put(xmin111.ymax ymaxB0=ymin then return 80+2*11). b8, or el se put (xmin1 11 yma: 80+11)
if if ymax100*0 then put(xmin111,yma ymax100=ymin then return x100+2*11 = ,bl0 .or else put(xmin111,yma 10#
return
rem passband,stopband,transi11 on region with b varietJbvaried**************
bvaried:
wS(l)="Sinc squared" : wS (2) = Inversed Von Harm : wS(3)="Sime"
w* (4)="Inversed Hamming":w*(5)="Inversed Von Hann squared"
w*(6)="Raised cosine f1=1/10b":wS(7)="Raised cosine +lr3/10b"
w*(8)="Raised cosine f1=1/2b":wS(9)="Raised cosine +1=7/100"
wS(10)="Raised cosine +1=9/100"
w*(11 > = "Rectangular":w<(12)"Hamming":wS(13)="Tri angular":wt(14) = "Von Hann"
w*(15)=Von Hann squared":w*(16>=Hamming squared":w*(17)="Kaiser"
w*<18)"Normalw*<19)="Inversed Kaiserw*!20)="Inversed Hamming Squared"
print"Selectione of windows: "
for 1=1 to 20
print i,wS(i)
next i
input"input only the number tor which the window to be used, s = ",s
prinf'if window is triangular then 4 of coefficients should not be"
print"multipie of 5,since the program can not determine +2"
input"input # of coefficients k = ",k
input"input the sample rate fs = ,fs
input"specify # of points to be calculated from 0 to fs/2 *,npoint
input"input # of iteration for Newtonmethod = ",n
input"input window bandwidth (>0>to start to plot from bw "fbstart
input"input bandwidth of the filter b = ",b
dim c(k),h(k),w(k),amp(npoint + 1),f(npoint + 1)
71
dim mag (b / 2+1) pbr (b/2+ 1) ,sba(b/2*1 ) del f
inde:=0
pi=4*atn(1)
for bw=bstart to b/2 step bst.art
1 nde:: = 1 nde.\ + 1
if 5 = 1 then gosub coef ficientsl
1 f 5 = 2 then gosub coef ficients2
if E = 3 then gosut coef fic i ent s3
1 f 5=4 then gosub coef fici ents4
1 f 5 = 5 then gosub coef flci ent s5
1 f S = i then gosub coefficient st
if s=7 then gosub coefficients
i f s=B then gosub coef flcient = e
if S = Q t her. gosub coef flc:ent =9
i f s= lii1 then gosub coef f i c i en*. s ip
i f 5=1 1 then gosut coefflcients 11
if 5=12 then gosub coefficients!2
if 5=13 then gosub coef fici ent s1
i f 5=14 then gosub coefficients 14
if 5=15 then gosub coef fici ent s ! 5
if 5=16 then gosub coef f i ci ent s 16
if 5=17 ther gosub coefficients !7
if 5=1B then gosub coeffici entsi 6
if 5=19 then gosub coeffici ent e 19
if e=20 then gosub coef f 1 ci ent 5 2l?J
gos Ltib pointplotted
gosub curve'
gosub passbandb
gosub stopbandt
gosub transitionb
next bw
gosub gget1
gosub bgetplots
goto bplots
return
rem to determine ama.:, ami n, then passband***************************
passbandb:
re* determi ne a*a.':******************************************
ma::=amp (1)
for i = l to npoint+1
if amp(i)>=max then max=amp < l ) : pmax = i : temp=pmax
next i
gosub newton
fmax=p
gosub amplitude
amax=a
rem determi ne ami n*************************************************
mi n=amp(1)
for i=l to pturn
if amp(i)<=min then min=amp(i):pmin=i:temp=pmin
next i
gosub newton
f mi n=p
gosub amplitude
ami n=a
rem determine passband ripple*******************************f^*****
r=amax/amin
pbr
return
rem to determine maximum magnitude in stopband region**************
72
Etopbandb:
smax=amp (pmi d!
f or i =pmi d* 1 to npoint*l
if amp (1 ) Ema: goto bstopma..
smax=amp (i )
next i
bstopmax:
smax=amp Cl ) : psmax=i : temp=psma.
for j = : + l to npoir.t + l
if amp < j ) ; = Â£max then sma : =amp , ) : ptma:. j : t emp=psma..
next j
gosut newton
f Ema =p
goEub amplitude
asma:=a
sbs (i nde .) =20*1 og i asma::) /: og (10
return
rem to determine f 1 and f2 for transition del f **************
tr ansi t i onb:
rem to determine f1+**+++*++**+********+********
f di f = f Ei7.a.. f tpturri!
f del = fdif if.s/2)
for 3 = 1 to f s / 2
atest=h (I?)
f test = f (pturn) +f del (l 1 )
for j=l to V
ctest=coE
atest=ateEt+2*h(j)*ctest
next j
atest=abs(atest)
if atest arnun then f1=ftestfdel:nn=::goto basmaxtest
next l
rem to determine f2****************************#*******
basmaxtest:
for i=nn to fe/2
atest=h (0)
ftest=f ipturn)*fdel *(i1)
for j=l to )
cteEt=coE(j *tl*ftest)
atest=atest+2*h(j)*ctest
next j
atest=abe(atest)
if atest
next i
bgetout:
delf(i ndex)=f 2f1
return
rem plots of passband,stopband,transition region of bvaried**************
bplots:
screen 2
cl E
wi ndow(0,0)(639.199)
line(20,30)(620,30)
1i ne(40,30)(40,190)
line(600,30)(600,190)
1=561/10
put(24,25),a0,or:put(28*1,25),al,or:put(28*2*1,25),a2,orIput(28*3*1,25),aT,or
put(28*4*1,25),a4,or:put(28*5*1,25),aS,or:put(2B*6*1,25),*6,or
put(28+7*1,25),a7,or:put(28+8*1,25),a8,or:put(2B+9*1,25),a9,Dr
put(28+10*1,25),410,or
73
1 = 151/10
put (610,31 + 1 ) b 1, or : put (610,31+2+1 ) b2. or : put (610,31+3+1 ) b3, or : put '610,31*+;
put(610,31+5*1),b5,or:put(610,31+6*1),b6,orlpjt(610,31+7+1;,b?,or
put(610,31+8+1),b8,or:put(610,31+9*1!,b9,or : put (610.31 + 10+1).b1B.or
1=151/10
put <10,31 + 1),c1.or 1 put(10,31+2*1),c2,or:put (10.31+3*1:,c3,or:put (10.314; 1 .cl.i
put (10,31+5+1),c5,or:put(10.31+6+1),c6,or:put (10,31*7 + 11,c7,or
put(10.31+B+1).cB.Dr:put(10,31+9*1>,c9,or:put(10,31+10*1),c10,or
1=151/10
put(55,31 + 1),dl,or:put(55,31+2+1),d2,or:put(55.31+3*1 d3,or:put <55.71+4*: d4, c
put(55,31+5+1),d5,or:put(55,31+6*1),d6,or:put(55,31+7*1),d7,or
put (55, 31+8*1 1 dB, or: put (55,31 +9*1 ) d9, or : put (55,31 +10+1 1 dl0, or
for i=30 to 180 step 15
pset(39,i):pset(41,1):pset(601,i): pset(599,i):pset(49.i):pset(51.i)
next i
for 1=0 to index step index/10
pset (40+560*i /i ndex 29) : pset (40+560*1 /i nde::, 31)
next i
for i=l to index
check=l
mag(:)=abs(pbr(i)> *150/pbmax
next l
gosub bdrawline
for i=l to index
check=2
mag(i)=abs(sba(i)>*150/sbmax
next i
gosub bdrawline
for i=l to index
check=3
mag(i)=abs(delf(l))*150/(dmax)
next l
gosub bdrawline
locate 24,1: prinfPlots of (l):pa=sband ripple in dB; (2):stopband antenuscior.
print"(3):transition region in Hr versus b with "w*(s>;" window used";
locate 1,2: print"(3>";: locate 1,B:print"(2)";:1ocate 1,77:print(1>":
return
bdrawli ne:
gosub bpput
for i=l to index1
line <40+560*1/index,30+mag(i))(40+560*(i + 1)/index,30+mag(i + 1))
next i
return
bpput:
if check=l then put(40+560/index,30+mag(1)),one,or
if check=2 then put(40+560/index,30+mag(1>),two,Dr
if check=3 then put(40+560/index,30+mag(1)),three,or
return
rem get axises for all the db plots of the curves with bvaried************
bgetplots:
pbmax=pbr(1):sbmax=abs(sba(1)):dmax=delf(1)
for i=l to index
if pbr(i>>=pbmax then pbmax=pbr(i)
if abs (sba (i ) ) ><=sbmax then sbmax=abs (sba (i > )
if delf
next i
pbmax=cei1(pbmax)
sbmax=10*cei1(sbmax/10)
dmax=10*ceil(dmax/10)
screen 2
113:01P<01S3><00) ia6:0X/l*xuiqa!
313:0X3* (0T *sZ)(00> 1*6:01/Taxauipt,,
iI3:0iq(0X1S3 ><00) i*6:0t/x#xuqdi
3i3:0x*(axs3)(00)>6:0t/i*<3/q>
SI3.6P <01 S3) < 0 0) l*6:0i/i*x*wqa8
313:63*(01S3)<00)1*6:01/x*xwpj
3I3:6q <0T *53)(0*0) l*6:0i/x*x*uiqd!##,
3 13:6'* <01S3)(0*0)iaB:0t/t*<3/q)!##,
si3:8P* <01 St
sip:ip(0is3>
st3:z3<0iS3)
sx3:/* <0t *S3><00) ^a6:0X/t*(3/q) :
3 13 :9P <01 sz
3X3: 9 *(01S3)<0
*0)ia6:0i/t*(3/q)i
3 13 :ga (01 S3) <0 *0) 336 :0I/ I + xeuip
ST3:gq* (01 S3) (0*0) ia6 :0I / x#x*iuqd
3 X3.se<01 S3)<00) Xa6;0i/:*(j:/q) i
3I3:t>P<0I*S3)<00) ia6:ax/ t*xeuiqss
3 13 :t?3 v0t S3) <00> xa6 :0l/ I*:
3 13 : trq (0X *S3) (0 0) xa6 :0X / t*xeuiqdj
s 13 :t?e (0; os) (00) ia6 :0i/ x* (3/q> !
X3:SP <01 *S3)<00) laS.^l/X + xeujqa!,,
3 13:23 <01 S3) <00) ia6 :0X/' I*::euipi
!3:xq <01 S3) <00) ia&:01/l*xeiuqd j
a 13:2<01*S3)<00>ia6:01/X*<3/Q) !
s 13 :Â£3 (01
3 13:3q
5p:;e <0i
3i3:xp(0i*s3)'0
313: <3* (01 S3)< 0
:: IQ < 01 S
s I 3 : i B { 0 t
<00)ia6:0I/I*(Â£/q)
= X3:gp<01*S3)<0 *0)iaB:ax/I*xemqs:,
s[3:03 (0i s3)(00) 136:01/ xbujp :,
313:01* (01 S3) <00) ia6 :0 x / X* xeujqd i,
3i3:0* :0x *s3) <00) ia6:0i/x*(x:/q)
ujn^aj
, # Butsn lutud
Bui an lutud
Butsn lutud
Butsn lutud 1 + 1=1
Butin lutud
.n Butsn lutud
Butsn lutud
Butan lutud 1+1=1
Butan lutud
Butan lutud
Butan lutud
Butan lutud 1+1=1
Butan lutud
Butan lutud
Butan lutud
Bu tan lutud 1+1=1
Butan lutud
Butan luTud
Butan lutud
Butan lutud 1 + 1=1
Bu tsn lutud
Bu tan lutud
Butsn lutud
Bu tsn lutud 1 + 1=1
Butsn lutud
Butsn lutud
Bu tsn lutud
Butan lutud 1+1 = 1
,### Bu tan iu i ud
Bu tan iu tud
* *# Bu tsn lutud
6utsn lutud 1 + 1 = 1
6u tan lutud
Bu tsn lutud
Butsn lutud
Bu tsn iu tud t+ [=1
Butsn iu tud
Bu tsn iu tud
Butsn lutud
Butsn lutud 1 + 1 = 1
Bu tan iu tud
###.. Butan iu tud
# # 6u tsn lutud
Butsn iu t ud 0=1 3X3
75
APPENDIX B
This appendix contains the program listing (named Uncertainty) to
calculate the uncertainty relationship for windows in Tables 1,2 and 3.
inverse von"
rem determine deltaT deltaF of windows
dim w$(30)
w$ (1>="rectangular": wt (3) = "tr l angul er : wi3) = vonhann "
wt (4) = "hammi ng : w* (5) = "normal : w* (6) = si nc squared : w# (7) = "
w* (S) ="si n" : w* (9) = "inverse hammi ng":wt(10)= "F.'ai sec cosine"
w*(11)="inverse von squared"
for i=l to 11
print i! w*(i)
next i
input"input only the number for which window is used ".s
if s=l then gosub rec
if s=2 then gosub tri
if s=3 then gosub vonhann
if s=4 then gosub hamming
if s=5 then gosub norma]
if s=6 then gosub sin2
if s=7 then gosub invon
if s=B then gosub sine
if s=9 then gosub inham
if s=10 then gosub raise
if 5=11 then gosub invonsq
end
rem normal ****************************** ****************
norma]:
els
m=20
i nc = .001
1ocate 1,1:pri nt
1ocate 2,1:prlnt
locate 3,l:print
print const a
foraa = 7000 to
pi =4*atn(1)
tnum=0
ffnum=0
dem= 1
for k=l to m
w=exp(aa*(i nc*k)
"Normal window"
"# of terms m = ",m
"increment T = ",inc
" ;"dT ";"theodT
100000 step 10000
2>
tnum=tnum+2* (k~2> *w^2* (i nc"'2>
dem=dem+2*w'2
dF
theodF ;"4*pi*dTdF
next k
delta=sqr(tnum/dem)
for k=m to m
wk=exp(aa*(inc*k>~2>
for l=m to m
wl*xp (aa* (i nc*l > ''21
if k=l then a=l/12 else a= ( (1) ' (k1 ) > / (2* (pi "2) (k1 ) ~2>
ffnum=ffnum+(l/inc^2)*wl*wk*a
next 1
next k
fa=sqr
result=4*pi*fa*del ta
res=fa*delta
thl=l/(2*sqr(aa)):th2=sqr(aa)/(2*pi)
print using "####*"!aa;:print using .####">delta,thl,f^th2,result
next aa
return
rem vonhann**************************************************
vonhann:
inc=.001
77
input "input the number of terms n = ",n
locate 1,1:print"Von Hann"
locate 2, 1 : pri nt "i ncreipent T = i nc
print "n ":"dt ";"theDT "S"dF ,,t"theoF "; "4*pi dT::r
for m=n/10 to n step n/10
pi=4atn(1)
tnum=0
f f num=0
denr.= 1
for k=l to m
w=.5+.5*cos(pi *k/m>
tnum=tnum+2* i k"'2) *w' 2* (i nc 2)
dem=dem2*w'2
next I
delta=sqr(tnum/dem)
for l:=m to m
wk=.5+.5*cos(pi*k/m)
for l=m to m
wl=.5+.5*cos(pi*1/m>
if k=l then a=l/12 else a= ( ( 1) ''(I1 ) ) / !2 (p: ,2 1 I 1 > 2)
ffnum=(fnum+(1/incA2)*wl*wla
next 1
next k
fa=sqrIffnum/dem)
result=4*pi *fa*de! ta
th1=minc*(sqr((1/?) (15/(bpi "2)>))
th2=1/(m*i nc*sqr(12) )
print misprint using "4444.4444";delta.th1,fa,th2,result
next m
return
rem tr i #***************************************
tri :
inc=.001
input"input the number of terms n = ",n
locate 1,1:print"Triangular"
locate 2, 11 pr int i ncrement T r ,mc .
print 'n ";"dt ;"theoT ";"dF ":"theoF ": "4*pidTdF'
for m=n/10 to n step n/10
pi=4*atn(l)
tnum=0
ffnum=0
dem=l
for k=l tD m
w=lk/m
tnum=tnum+2* < k "2) (w"'2) (i ncA2)
dem=dem+2*w''2
next k
delta=sqr(tnum/dem)
for k=mto m
if k>=0 then wk=lk/m else wk=l+k/m
for l=m to m
if 1>=0 then wl=ll/m else wl=l+l/m
if k=l then a=l/12 else a= ( (1)' (k1.') / (2* (pi A2) (k1 ) A2)
f f num=f f nufflt (1 /i nc'"2> *wl *wk*a
next 1
next k
fa=sqr(ffnum/dem)
result4*pi*fa*delta
res=fa*delta
thl=m*inc/sqr(10)
th2= (sqr (T> ) / (Op; *m+: nc )
th~=thl*th2*4*pi
prir.t in;:print using "####.####": ael ts, th 1.f a. t h2, r esul t
ne>:t m
ret ur n
rerr. hpmffii ng+**+*+***+*+*++*+++++++++++*++*++++++*+++*++++++*
hamming:
l nc= 01;'1
input, "input the number of terms n = ",n
locate 1,1:print"Hamming"
locate 2,1:print"increment T = ",inc
print n "i"dt "i"theoT ":"dF ":"4*pi*dTdF
for m=n/l!;l tci n step n/10
pi =4 + atn(11
tnum=C>
ffnum=0
dem=l
for 1=1 to m
w=. 54 + 46+cos (pi +1 /m)
tnum=tnum+2 O: "2)*w "2+(i nc"2!
dem=dem+2*w "2
next t:
delta=sqr(tnum/dem)
for k=m to m
wt:=. 54+. 46*cos (pi ) /m)
for l=m to.m . .
wl=.54+.46*cos(pi*l/m>
if ( =1 then a=l/12 else a= ( (1) (I1 1 ) / (2+(pi "2>+/11 "'2)
f f num=f f num+ (1 /inc "'2) *wl *wl;a
next 1
next V;
fa=sqr(ffnum/dem)
result=4*pi+fa*delta
res=fa*delta
thl=m*inc*sqr((1/3>(16.54*.4fc.46"2)/(2+pi'2))
print m;:print using ####.#*##": del t a. th 1, f a. resul t
next m
return
rem rectangul ar ***********+**#***+*+++****+*+*#*******+***+*****
rec:
i nc=.001
input"input the number of terms n = ",n
locate 1,1:print"Rectangular"
locate 2,1:print"increment T = ".inc
print "n "!"dt ';"theoT Ms"dF "; "4*pi*dTdF'
for m=n/10 to n step n/10
pi=4#atn(1)
tnum=0
ffnum=0
dem= 1
for k=l to m
w=l
tnum=tnum+2* (lr~2) *w^2* (i nc~2)
dem=dem+2*w'"2
next k
delta=sqr(tnum/dem)
for k=m to m
wk=l
for l=m to m
wl = l
79
if k=l then a=l/12 else a= ( (1) '' (l;l ) ) / (.2* (pi 2) ( k1 ) '1 >
f f num=f fnum+ (1 /i nc^"2> *wl *wk*a
next 1
next k
f a=sqr (f fnum/deni)
resul t=4*pi *f a*del ta
res=fa*delta
thl=minc/sqr(3)
print m::print using "####.###"! delta,th1,fa,result
next m
return
rem si no**************************************************
sine:
defdbl az
m=30
input"input the increment T = ",t
locate 2,1:print"number of terms ",m
locate 1,1:print"sinc"
print"B "s"dT "("dF ";"theoF ";"4*pi*dTdF
for b = (l/t>/10 to ( (1/t)/2>/10
pi =4#atn(1)
tnum=0
ffnum=0
dem=1 .
for k= 1 to m
w=(sin (2*pi *b*t*k))/(2*pi *b*t*k)
tnum=tnum+2*
dem=dem+2*w/'2
next k
delta=sqr(tnum/dem)
for k=m to m
if k=0 then wk=l else wk.=si n (2*pi *b*t*k ) / (2*pi *b*t*k)
for l=m to m
if 1=0 then wl=l else wl=sin(2*pi*b*t*1)/(2*pi*b*t*l)
if k=l then a=l /12 el se ,a= < (1) (k1 ) ) / (2* (pi 2) (k1 ) ~2>
ffnum=ffnum+(1/t^2)*wl*wk*a
next 1
next k
f*=Bqr(ffnum/dem)
result=4*pi*fa*delta
res=fa*delta
theory=b/(sqr(3))
print b;:print using "*###.####";delta,fa,theory,result
next b
return
rem sinc2**************************************************
sin2:
defdbl az
m=30
input"input the increment T = ",t
locate 2,1:print"number of terms ",m
locate 1,1:printsin squared
prinfB ""dT ""theoT ";"dF "jtheoF
for b (l/t)/10 to /2 (l/t)/10 step (l/t)/10
pi4*atn(l)
tnum=0
ffnum=0
dem=l
for k=l to m
*^(sin(pi*b*t*k)/(pi*b*t*k))~2
";"4*pi*dTdF"
80
tnum=tnum+2* (k"'2) (w~2) *(t'2>
dem=dem+2*w'"2
next k
delta=sqr(tnum/dem)
for k=m to m
if k=0 then wk=l else wk=(sin(pi*b*t*k)/(pi*b*t*k)!'2
for l=m to m
it 1=0 then wl = l else wl = (si n (pi *b*t *1 ) (pi *b*t *1 ) ) "2
if k=l then a=l/12 else a= ( (1) ' (k1 ) ) / (2* (pi 2) (k1 ) ~2)
ffnum=ff num+(1/t"2)*wl #wk*a
next 1
ne t k
fa=sqr (f tnum/dem)
re6ult=4*pi *fa*delta
res=fa*delta
thl=sqr(3)/(2*b*pi)
th2=b/(sqr(10))
print b;:print using "####.*###";delta,thl,ta,th2,result
next b
return
rem i nverse von**************************************************
invon:
detdbl az
m=50
input"input the increment T = ",t
locate 2,1:print"number ot terms ",m
locate 1,1:printInverse Von Hann"
print"B ";"dT ";"dF ";"4*pidTdF"
tor b = (l/t)/10 to
pi =4*atn(1)
tnum=0
ffnum=0
dem=l
tor k=l to m
tt=b*t*k
it tt=.5 then w=. 5 else w= (si n (2*pi *b*t*k) / (2*pi *b*t*k) ) / (1 (2*b*t*k )'"2)
tnum=tnum+2* (k~2) (w"2) (t~2)
dem=dem+2*w^2
next k
delta=sqr(tnum/dem)
tor k=m to m
tt=abs(b*t*k)
it k0 then wk=l else wk=sin(2*pi*b*t*k)/(2*pi*b*t*k)/(1(2*b*t*k)A2)
it abs(tt.5X.000001 then Mk=.S
tor 1=m to m
tl=abs(b*t*l)
it 1=0 then wl=l else wl=sin(2*pi*b*t*l)/(2*pi*b*t*l)/(1<2*b*t*l>'2)
it abs(tl.5)<.0000001 then wl=.S
it k=l then e1/12 else a= <(1>~/(2*(pi~2>*(k1>~2>
ffnum=ttnum+(l/t~2> *wl*wk*a
next 1
next k
ta=sqr(ttnum/dem)
result=4*pi*fa*delta
print b;:print using "*##.##**"; delta,fa,result
next b
return
rem inverse von sguared>*****
invonsq:
detdbl az
m=50
input"input the increment T = ",t
locate 2, 1: pri nt''number of terms m
locate 1 1: pr j nt'' 1 nver se Von Hanr, Squarec"
print"B "dT ";"dF ";"4*pi*dTdF"
fGr b = (l/t.'ll;> to (l/t).'2 step (l/t>/ll!>
pi=4atn 1)
tr,um=i3'
f f num=Â£>
dem= 1
for 1=1 to m
tt=b*t*l
if tt=.5 then w=(.5) 2 else w= > s i n C2*p i t i 2 P i *0* t *1.) ) / (1 (2*b*
tnur.=t num*2* I "2? (w"2!* t 2)
dem=dem+2w 2
next 1.
delta=sqr(tnum/dem)
for I =m to m
tt = abs(b t 1 )
if 1=1? then wk=l else wl = (si n (2*pi *b*t i ) / (2p: *t *t *1 ' 1 2*b*t I )'2
if abs(tt,5' 0!?0l?i? 1 then wk=(.5! 2
for l=m to m
t l=abs
if 1 =(? then,wl = l else wl = ( si n.(2*pi *b*t ] ) / <2*pi *bt 1 ) / (1 (2tt 1 1 2 *
if tfbs.'2
if 1=1 then a=l/12 else a= ( < 1) (I 1 > / 2 pi 2) (I1 ) 2)
f f num=f f num+(1/t "2> *wl wl *a
next 1
next 1.
fa=sqr(ffnum/dem)
result=4*pi*fa*delta
res=f a*delta
print bilpnnt using "*###. #*MMt : del t a. f a. r esul t
next b
r etur n
rem inverse
i nham:
defdbl ap
m=3(ii
input"input the increment T = ",t
locate 2,1:print"number of terms ",m
locate 1,1:print"Inverse hamming"
printB ";"dT ";"dF ";"theoF ";"4*pi*dTdF
for b = to (l/t)/2 (l/t>/10 step d.'t>/10
pi =4*atn (1)
tnum=0
ffnum=0
dem=l.0B 2
for k = l to m
tt=b*t*k
aa=si n (2*pi *b*t*k) / (2*pi *b*t*l )
bb= (B*tt';'2) C.54.46)2. 54
cc= (4*tt',2> 1
if abs (tt.5)<.000001 then w=(.46) else w=aabb/cc
tnum=tnum+2* C1: 2 > (w~2) < t ''21
dem=dem+2*w'2
next I:
delta=sqr(tnum/dem)
for l;=m to m
tt=abs
82
bb=<8*tt2)*(.54.46)2*.54
cc= (4*tt '2) 1
if 1:00 and cc<*0 then wk= (si r, 2*p i *b*t I ) / 2*pi *b* t 1 ) ) *bb ,'cz
if l:=0 then wl:=2*.54
if abs (tt.5) 000001 then wl:=!.46>
for 1=m to m
tl=abs(b*t*l)
bb= (B*t 1~2 > *(.54.46 > 2* 54
cc=(4*tl'2)l
if 1O0 and ccOP then wl = < si n (2*pi *bt 1 1 (2*pi *b* t *1 ) ) *bb/cc
if abs(t1.5)<0000001 then wl=(.46)
if 1=0 then wl=2.54
if k=l then a=l/12 else a= ( (1) (I1 ) ) / (2* (pi 2>Un~2>
ffnum=ffnu+(l/t~2)*wl*wl*a
ne::t 1
next I:
fa=sqr(ffnum/dem)
result=4*pi*fa*delta
re==f a*delta
theory=b*sqr ((l/3)(16*.54*.46.462).'(2*pi'2>)
print bilprint using "####.###(*"(delta,fa,theory,result
next b
return
Raise:
defdbl ar
m=50
input"input the increment T = , t
locate 2,1:print"number of terms m
locate 1,1:print"Raised Cosine with fl is a function of B"
pri nt "B "*"dT "!"theoT ";"dF "!"theoF ";"4*pi*dTdF"
for b = /10 to (l/t)/2 step (l/t)/10
pi=4*atn(l)
fl=b/2
tnum=0
ffnum=0
dem=l
for k=l to m
tt=(bf1> *t*k
a=sin(pi (f 1+b) *t*k) / (pi* (f 1+b) *t*k >
bb=cos(pi*tt)
cc=1(2*tt)~2
if abs(tt.5)<.000001 then w=aa*pi/4 else w=aa*bb/cc
tnum=tnum+2* (k',2) (w~2) (t''2>
dem=dem+2*w'2
next k
delta=sqr(tnum/dem)
for k=m to m
tt=abe( (bfl)*t*k)
bb=cos(pi *tt)
cc=1<2*tt)~2
if k< >0 and cc<>0 then wk= (sin (pi (f 1 +b) *t*k) / (pi (f 1+b) *t *k) ) *bb/cc
if k=0 then wk=l
if abs(tt.5)<.000001 then wk=(sin(pi *(f1+b)*t*k)/(pi *(f1+b)*t*k))*pi/4
for l=m to m
tl=bs<(bf1)*t*l1
bb=cos(pi*tl)
cc=l(2*t1)
if 1 < >0 and cc<>0 then wl*= (si n (pi (f 1+b ) *t*l > / (pi* (f 1+b) *t*l ) 1 *bb/cc
if 1=0 then wl=l
83
i *f abÂ£ < 11 . 5) < . then w) = < si r, (p i t f l +b ) *t 1 ) / (&i (f 1 b) t 1 ) *pi/A
lf k = l then a=l/12 else a= ( v1) (k1 ) ? / <2* (pi 2) 'J1 ) 2)
f *f num=tf num+ (1 /tr*2) *wl *wl +a
ne;:t 1
ne::t I
fs=sqr
result=4*p i *f a*del ta
re==f a^delta
th 1 = 1 / ( sqr (12* (bf 1 > (b + 5*f 1/3) ) )
th2=sqr ( ( (f 1 3) /3f (b "3f 1 '3) /B ( / '4*pi ) > 2* (I3*b*l7*f 1) ) / (4 1*7* (t* 1 '2;
print b;:print using "####.####"; delta,thl,* a.th2,result
ne^t b
return

