2004:308 CIV
M A S T E R ' S T H E S I S
The Creation of a Sound Simulation System for People Affected by
Tinnitus
Maria Snäll
Luleå University of Technology MSc Programmes in Engineering
Department of Computer Science and Electrical Engineering Division of Signal Processing
2004:308 CIV - ISSN: 1402-1617 - ISRN: LTU-EX--04/308--SE
The Creation of a Sound Simulation System for People Affected by
Tinnitus
Maria Sn¨ all
Lule˚ a University of Technology
Dept. of Computer Science and Electrical Engineering Division of Signal Processing
December 10, 2004
ii
A BSTRACT
Tinnitus is a medical condition that manifests itself as a ringing, beeping, or humming noise to the affected person. The intention of this project is to help people with tinnitus recreate the sound they hear inside their heads. This is done to help increase the under- standing of tinnitus to unaffected people. Within the project a sound simulation system has been created, where the sound can be tuned to match the sound of an instance of tinnitus with adjustable parameters and a plot to help visualize the sound.
In the sound simulation system there are a few different parameters that can be changed.
There is a sinusoid tone, a distorted sinusoid tone and two changeable coloured noise.
The coloured noise is created by filtering white noise with an infinite impulse response (IIR) bandpass filter.
The actual sound simulation system is implemented in MATLAB and the user interface is made in Java as a remote tool with the ability to access the sound simulation system via the Internet.
iii
iv
P REFACE
This Master’s thesis was written by Maria Sn¨all. The actual idea to the thesis comes from the company NovaCast AB in Ronneby. The work was performed at the division of Signal Processing at Lule˚ a University of Technology in Lule˚ a.
This project has taken a lot of time to finish, and the result is unfortunately not a usable program. The most difficult issue with this project has been to fully understand the signal processing theory used. Many sidesteps has been taken but the project is finally completed.
I would like to thank the department of Computer Science and Electrical Engineering for making this project possible. My examinor Johan Carlson at EISLAB; thank you for helping me finish this thesis! A special thanks to Krister Engberg at the division of Signal Processing for the help with everything!
The next person I would like to thank is Carl Knutsson for the RMI server he made.
I would also like to thank Fredrik Bengtsson at the division of Computer Science and Networking for all the support during this project and all the help with the proof-reading.
A big thank you to Northwestern University, Chicago, IL, USA for letting me use their picture of the ear in section 2.1 which they call the “master ear”. Thanks!
Lule˚ a, Maria Sn¨all
v
vi
C ONTENTS
Chapter 1: Introduction 3
1.1 Background . . . . 3
1.2 Objectives . . . . 3
1.3 Strategy . . . . 4
1.4 Document Outline . . . . 4
Chapter 2: Background 5 2.1 The Ear and Hearing Experiences . . . . 5
2.2 Tinnitus . . . . 7
Chapter 3: Signal Processing Theory 11 3.1 Introduction . . . . 11
3.2 Stochastic Processes . . . . 12
3.3 Digital Filters . . . . 15
3.4 Stability . . . . 17
3.5 Designing Filters . . . . 20
3.6 Tools in MATLAB . . . . 22
Chapter 4: Implementations 25 4.1 Implementation in MATLAB . . . . 26
4.2 Implementation in Java . . . . 31
4.3 Issues and Improvements . . . . 34
Chapter 5: Conclusions 35
C HAPTER 1 Introduction
1.1 Background
Tinnitus is a medical condition that can manifest itself as many different noises inside a person’s head. Some examples are humming, beeping, scratching or ringing. To some people this can be very distracting and disturbing both in their daily work and in their social life, while other affected people are not bothered at all. Anyone can get tinnitus, especially people that expose themselves to loud music and long-lasting noise. The num- ber of people affected is increasing, especially among young people. There exists some treatments with varying effectiveness, but no general solution.
The original idea to this Master’s thesis comes from the company NovaCast AB in Ron- neby and has been carried out at the division of Signal Processing at Lule˚ a University of Technology.
1.2 Objectives
The intention of the project is to help people with tinnitus recreate the sound they hear inside their heads to increase the understanding of tinnitus for non-affected people. This is done using a sound simulation system capable of generating both noise and tones with adjustable parameters and a plot to help visualize the sound. The sound simulation
3
system can create both noise and tones, because a tinnitus noise often consists of both noise and tones.
1.3 Strategy
The generated noise is created out of white noise that is input to a second-order bandpass IIR filter with adjustable center frequency, bandwidth, and gain. The tones are pure sinusoidal tones and a distorted sinusoidal tone, which both have frequencies between 1000 and 12000 Hertz. It is also possible to adjust the gain of the tones.
The sound simulation program was first done as a MATLAB program with a Graphical User Interface (GUI). To be able to use the program over the Internet, a Java applet was created, which is using RMI (Remote Method Invocation), see section 4.2.2, to communicate with a server that interacts with MATLAB through the Java interface.
The reason why MATLAB was chosen is that it is a good tool when working with signal processing and it is a de facto standard for both universities and industry. Java was chosen because it is reputed to be a simple programming language to build applets with, and since it is easy to interact between Java and MATLAB. Unfortunately, this did not turn out to be the case. The RMI server was written by Carl Knutsson, a student at the program of Computer Science and Engineering.
1.4 Document Outline
The Master’s thesis is organised in the following way: Chapter two presents some back-
ground on the ear and hearing experiences. It also discusses causes and treatments for
tinnitus. In chapter three, the signal processing theory is presented, and in this chapter
for example stochastic processes, filter design and stability are discussed. Chapter four
presents the implementations, how the sound simulation system was created and how the
user interfaces were implemented. Chapter five concludes this Master’s thesis.
C HAPTER 2 Background
2.1 The Ear and Hearing Experiences
The ear can be thought of as a receiver of sound waves of different frequencies and amplitude. You can decide what you want to listen to and filter the incoming sounds in a noisy environment. Disturbing sounds can be neglected and interesting sounds can be emphasized. This is to be discussed further, later in the thesis. [1] and [2] have a more detailed description of the ear and hearing.
2.1.1 The Ear
The ear is the organ that converts sound to nerve impulses. It can sense sound waves from approximately 20 to 20000 Hertz. Hearing is often impaired with age.
The ear consist of the outer ear, the middle ear and the inner ear. The outer ear consists of the visible part of the ear (the pinna) and the auditory canal leading to the eardrum.
The visible part of the ear is built up of cartilage without useful muscles. The middle ear consists of the ear drum, the ossicles, the oval and the circular window and the eustachian tube. The inner ear consists of the cochlea, the vestibule, the semi-circular canals and a part of the cochlear nerve. In figure 2.1 the anatomy of the ear is shown.
5
6 Background When sound vibrations in the air reaches the visible part of the ear, the vibrations traverse the auditory canal, where the sound magnitude is amplified by resonance. The vibrations make the eardrum vibrate, which makes the ossicle swing. The ossicle consists of the malleus, the incus and the stapes. The sound increases when the stapes attached to the oval window start to vibrate. The vibration of the oval window are transfered to the fluid in the cochlea, a small shell-shaped bone, where there are about 15000 sensory receptor cells called outer and inner haircells. The pressure changes in the fluid are transfered to the receptor cells and the basilar membrane they are connected to. The receptor cells are attached to different pitches, with the darkest tones at the top of the cochlea and the brightest tones at the bottom, close to the round window. The nerve impulses are then transfered by the cochlear nerve to the auditory centre in the brain, where the actual sound is heard. The semi-circular canals are not part of the hearing experience, but handle balance.
The cochlear nerve contains both ingoing (afferent) and outgoing (efferent) nerve fibres between the brain and the cochlea. The so called inner haircells transfer sound informa- tion from the cochlea to the auditory centre inside the brain, and are therefore afferent nerve fibres. The purpose of the efferent nerve fibres, which consists mostly of so called outer haircells, is to enable the human ear to hear specific sounds in environments with disturbing surrounding sounds. The outer haircells provide for the high sensitivity and high-frequency resolution of the cochlea. With that comes the possibility to select which information to listen to.
When the inner and outer haircells are injured, the hearing becomes impaired. The inner haircells are the biological transducers of sound and when they are injured, the hearing deteriorates. When the outer haircells are injured, it becomes more difficult to hear specific details when there are a lot of disturbing sounds. Haircells can repair themselves if the damage is small. If the damage is severe, the haircells will neither be reproduced nor recovered.
2.1.2 Hearing Experiences
Anything that can vibrate can produce a sound. If the vibration is heard, the sound is
“audible”. A person cannot hear the vibration itself. The vibrating object causes a wave motion in the air, the wave reaches the ear and the process of hearing begins.
The cochlear nerve codes the frequency and the time pattern of a sound. The central
auditory nervous system receives information from the cochlea. The information is then
analysed and interpreted. Parameters analysed are frequency, intensity and time. A
2.2. Tinnitus 7
Figure 2.1: The anatomy of the ear
great deal of this processing happens in neural centers that are located in the auditory brainstem and cortex. Sound localisation depend on the interaction of information ar- riving at the two ears, based on phase comparison. The auditory nerves interact only in the brainstem and cortex.
2.2 Tinnitus
Tinnitus is latin for a ringing, jingling or rattling sound. Tinnitus is a medical condition, not a disease, with symptoms such as a ringing, buzzing or humming in one or both ears without any outer stimulation. It is a common phenomenon that has probably always existed. The first documentation, as [3] speaks of, of tinnitus is from Egypt in the 18th century before Christ, where they speak of “bewitched ears”, and the treatment was to drip olis into the ears. Almost everyone has at some time in their life experienced tinnitus as a temporary annoying noise in one or both ears.
Sleep and the ability to concentrate are often factors that are affected for tinnitus patients.
8 Background
For most of the affected persons, tinnitus is not a big problem, but there are also persons with very large problems. Loud volume of tinnitus can completely debilitate a person.
For more thorough information on tinnitus, see [3].
2.2.1 Causes
It is not always possible to determine the specific cause of tinnitus. High intensity sound, for example loud concerts and prolonged exposure to noise, can cause tinnitus. This is because the haircells in the cochlea might become injured or that the ossicles in the middle ear can get damaged, causing hearing loss. Tinnitus is very often related to an impaired hearing. Deaf people often have tinnitus even though they cannot hear actual sounds.
Contracting tinnitus from a trauma, for example a car accident, is also possible. It can arise either from the actual accident or a psycological trauma afterwards. It is not certain that stress can cause tinnitus, but for a person that has tinnitus, stress can aggravate the condition.
It is also possible to contract tinnitus from medication, for example high doses of acetyl- salicylic acid can cause temporary tinnitus. Ear infections can also cause tinnitus, because when an ear infection is not treated it can spread to the inner ear and cause meningitis [1], a very serious condition, which in turn can cause tinnitus.
Having a faulty set of teeth can cause tinnitus, because of tensions in the jaw muscles.
This is why some tinnitus patients actually get a referral to a dentist.
There is also a disease called Meni`ere’s disease that manifests itself as dizziness, impaired hearing and tinnitus. The cause is not completely known, but the liquid balance in the inner ear has some relation to it. The dizziness is often the most annoying symptom, but tinnitus is often the reason patients seek help. Tinnitus often deteriorates if accompanied by dizziness. Meni`ere’s disease can be treated with surgery.
However, some people continue their life without seeing a specialist for their tinnitus.
They have learned to live with it. Most of the tinnitus patients will never totally get rid
of their tinnitus.
2.2. Tinnitus 9
2.2.2 Treatments
There is constantly research going on to find better treatments for tinnitus. The treat- ment is often related to the cause and the level of affliction of the patient.
Even though there is no ultimate cure, the symptoms of tinnitus can often be reduced.
The noise intensity can be reduced and it is possible to learn to live with it. It is often important with understanding from the medical doctor and the surrounding people, and acceptance of the tinnitus by the patient in the treatment of tinnitus.
The treatment options that will be discussed in this thesis are only a few treatments that have been used through history with varying results. One early method used, was to cut of the hearing nerve, but that did not stop the tinnitus, it only cut off the hearing on that ear.
A few farmacological attempts have been done to find a cure for tinnitus. The best result were attained when Xylocain was used. 60% of the patients that tried Xylocain got a momentary silence from their tinnitus. Also, anxiety and anti-depressive medication has been tested with some progress when the patient was depressed and suffering from tinnitus. However, a simple medical solution is still missing.
Hearing aids can be used to mask tinnitus. It is often easier to disregard tinnitus when the surrounding sounds are louder. There are also special masks available which generates coloured noise or other sounds. Some other ideas in treating tinnitus are that patients should simply learn to accept the noise, and with acceptance comes relief. Acupuncture is sometimes mentioned when treatments are discussed. Patients with a faulty set of teeth can get a bite strip and experience a relief from their tinnitus. For more tinnitus information, see [3].
2.2.3 Tinnitus and Signal Processing
Tinnitus often consists of white or coloured noise and one or several tones. This makes it
possible to reconstruct some tinnitus sounds with the help of signal processing. However,
tinnitus can often be very complex and recreation of the sound can be difficult. The
recreation of tinnitus noises can be helpful for understanding of the condition for people
in the patient’s surroundings. Recreating the tinnitus noise can make the tinnitus patient
calm and satisfied knowing that other people can hear the noise too and understand what
the patient is suffering from.
In the sound simulation system white noise is input to a bandpass filter. Changing the
white noise into coloured noise, is making it similar to a tinnitus noise. A tinnitus tone
can be similar to a sinusoid tone or a distorted sinusoid tone or a combination of both
and has a frequency content between 1000 and 12000 Hertz, as a person working at the
hospital in Sunderbyn stated from his experience of tinnitus patients. While this is the
most common spectrum, there might exist patients with higher or lower tinnitus tones.
C HAPTER 3 Signal Processing Theory
In this chapter the signal processing theory of this report is handled. In section 3.1 there will be a short introduction to what will be discussed in this chapter.
3.1 Introduction
Tinnitus is a medical condition that can occur as a ringing, humming or buzzing noise in one or both ears. It can be a temporary or permanent condition. This can be very annoying and debilitating to the affected person. The noise a person with tinnitus can hear is similar to white and coloured noise. Coloured noise is created with the help of a filter and white noise. A pure tinnitus tone can be recreated with a sinusoid. If the tone has much distortion it can be recreated with a distorted sinusoid tone. The tinnitus noise is often complex and consists of both a noise and a signal. This can be recreated by adding coloured noise to a sinusoid. In figure 3.1 the process of creating tinnitus noise is shown.
White noise is the input to a bandpass tunable filter that is used to shape noise in this project. The output of the filter is coloured noise. The wanted qualities of the noise are found with adjustable bandwidth and center frequency in the bandpass filter. This means that the noise can be changed from a high-frequency to a low-frequency noise with the help of these parameters.
Colouring white noise is a process that uses signal processing theory of for example
11
12 Signal Processing Theory
Bandpass filter
Bandpass filter White noise
Tinnitus noise
Figure 3.1: Block diagram for the sound simulation.
stochastic processes; the theory behind white noise and a step needed for understanding coloured noise, filter design; various techniques for designing filters, and stability; be- comes an issue when dealing with digital filters. A sinusoid is easy to make and will not be discussed in any specific section of this report. A distorted tone is like a sinusoid with some distortion on it.
Stochastic processes are discussed in section 3.2, where the transformation from white to coloured noise is investigated. Section 3.3 discusses digital filters and the differences between digital infinite impulse response (IIR) filters and digital finite impulse response (FIR) filters. The stability issue of a filter is important and will be discussed in section 3.4. In section 3.5 the different aspects of filter design is handled and in section 3.6 the MATLAB tools used in this project will be declared and explained.
3.2 Stochastic Processes
A stochastic signal is assumed to be a member of an ensemble of signals that is character- ized by a set of probability density functions. For a specific signal at a specific time, the signal’s amplitude is assumed to be determined by the underlying statistical properties.
A discrete-time random process is a sequence X[n] whose value at each time point is a random variable. The mean of a discrete-time random signal is defined as
µ X [n] = E(X[n]). (3.1)
3.2. Stochastic Processes 13
The variance is then defined as
σ X 2 [n] = E(X[n] − µ X [n]) 2 = E(X[n] 2 ) − (µ X [n]) 2 . (3.2) The auto-correlation function is of interest at two different time indices m and n
r X [m, n] = E(X[m]X ∗ [n]), (3.3)
where * denotes complex conjugation. In this project, X[n] is always real.
Random signals are often so called wide sense stationary (WSS) random processes for which some of the key statistical properties are either independent of time or of the time origin, which will be true if these two properties are fulfilled:
1. The mean µ x [n] is the same at all time points:
µ X [n] = µ X = const. (3.4)
2. The auto-correlation function is one-dimensional, it only depends on k:
r X [k] = E(X[n]X[n + k]). (3.5)
r X [k] is only dependant of the difference k between n and n + k. The power spectral density (psd) is the Fourier transform of the auto-correlation function and is therefore defined as
R X (Ω) =
∞
X
k=−∞
r X [k]e − jΩk . (3.6)
R X (Ω) is a periodic function of Ω with a period of 2π. To receive the auto-correlation function the inversion formula is used on an interval from, for example −π to π. The inverse is then
r X [k] = Z π
− π
R X (Ω)e jΩk dΩ. (3.7)
White noise is the input to the system when the coloured noise is created in the sound simulation system. White noise is a stochastic process with constant psd R W (Ω) = σ 2 . The auto-correlation function is then
r W [k] = σ 2 δ[k] = σ 2 for k = 0
0 for k 6= 0 , (3.8)
where δ is the Kronecker delta defined as
δ[k] = 1 for k = 0
0 for k 6= 0 . (3.9)
14 Signal Processing Theory
x[n]
H(Ω)
y[n]
Figure 3.2: Input-output model.
0 0.5 1 1.5 2
x 10
4−100
−50 0 50 100
Frequency (Hz)
Phase (degrees)
0 0.5 1 1.5 2
x 10
4−80
−60
−40
−20 0
Frequency (Hz)
Magnitude (dB)
Figure 3.3: The frequency response and phase shift of the output y[n].
The coloured noise made in this project is the output y[n] of figure 3.2. The input x[n]
is white noise and H(Ω) is the bandpass filter used in this project to create coloured noise. The filter used in this project is good for this purpose, because it is a tunable filter and when white noise is run through the filter the output will be a well tunable coloured noise. In figure 3.3, the upper plot shows the frequency response and the lower plot shows the phase shift of the coloured noise. The x-axis is labeled in Hertz since the sound that comes out of a speaker is in Hertz.
In this section, [4] and [5] have been used as references.
3.3. Digital Filters 15
3.3 Digital Filters
This section will handle two different digital filters, FIR and IIR filters. There will be a comparison between the filters and a discussion why the filter used in this project was chosen.
Finite impulse response (FIR) filters are named after the finite impulse response. An FIR filter of length M with input x[n] and output y[n] is described by the difference equation
y[n] = b 0 x[n] + b 1 x[n − 1] + ... + b M −1 x[n − M + 1] =
M −1
X
k=0
b k x[n − k], (3.10)
where b k are the filter coefficients. An FIR filter is non-recursive and depends only on the samples from the input.
Infinite impulse response (IIR) filters are named after the infinite impulse response. The difference equation for an IIR filter looks like
y[n] =
N
X
k=1
a k y[n − k] −
M
X
i=0
b i x[n − i], (3.11)
where a k and b i are the filter coefficients [6]. An IIR filter is recursive, which means that the filter depends on samples from previous outputs.
3.3.1 Digital Finite Impulse Response Filters
This section will discuss advantages and disadvantages of FIR filters. The bandpass filter used in this project is not an FIR filter, and in this and the next section it will be obvious why.
Digital FIR filters cannot be derived from analog filters, because rational analog filters cannot have a finite impulse response. Digital FIR filters have certain unique properties that IIR filters (whether analog or digital) not share, such as:
1. They are inherently stable, because FIR filters can be designed to be stable and does not have feedback that can cause instability as IIR filters have.
2. They can be designed to have a linear phase or a generalised linear phase. Linear
phase filters has less phase distortion than non-linear phase filters.
16 Signal Processing Theory
3. There is great flexibility in shaping their magnitude response.
4. They are convenient to implement.
FIR filters can also have a major disadvantage with respect to IIR filters: For an FIR filter meeting the same specifications as a given IIR filter, the FIR filter will require many more operations per unit of time. FIR filters are absolutely stable since they only have zeros and no poles, see more in section 3.4. Only FIR filters can have linear phase, which means that the filters will not cause any phase distortion.
In this project, an FIR filter would have made it more difficult to change parameters in the sound simulation system. The bandpass filter used in this project has only two parameters to change in the sound simulation system. An equivalent FIR filter would have had more parameters to set than the IIR filter.
Consequences when using FIR filters is that FIR filters needs many taps for selective filters and that FIR filters give long delays. This will not be a problem if the delay time does not matter for the process.
More can be read in [5], [6], [7] and [8].
3.3.2 Digital Infinite Impulse Response Filters
This section will help to explain why a digital infinite impulse response (IIR) filter is used in this project. The idea to create coloured noise with white noise and an IIR bandpass filter has to be explained, and will so be in this section.
An IIR filter is a recursive filter, which is more computationally efficient than a non- recursive filter, just because it is recursive and has fewer parameters to consider than a non-recursive filter, but a recursive filter can easily become unstable and lose phase linearity. It can become unstable because the output has feedback and therefore has poles, and the pole placement decides the stability. Read more about poles in section 3.4.1. Since an IIR filter is used in this project to create coloured noise it is not possible to have linear phase. In this case phase linearity does not matter, because the phase does not make a difference for the sound created in this project. A change in phase will change the noise in a way that can be noticeable for the human ear, but since it is noise it is difficult to decide whether it is a change in phase or not.
There exists many different digital IIR filters and they will only be briefly mentioned
here. The most common types are Butterworth, Bessel, Chebyshev Type 1 and 2 and
3.4. Stability 17
elliptic approximations. These are analog filters, but corresponding digital filters can be made with predefined MATLAB functions.
The bandpass filter used in this project is an IIR second-order bandpass filter. It is filtered with the help of MATLAB’s filter function. The transfer function of the filter looks like:
H BP (Ω) = 1
2 [1 − α − β(1 + α)e − jΩ + e − 2jΩ
1 − β(1 + α)e − jΩ + αe − 2jΩ ], (3.12) where α and β are adjustable parameters. When α increases, the bandwidth of the filter decreases, and when α decreases, the bandwidth of the filter increases. When β increases, the center frequency of the filter increases. The filter moves in frequency with the change of β. This is a tunable filter and is good for creating coloured noise, as in this project.
The squared magnitude function of the filter is given by
|H BP (Ω)| 2 = (1 − α) 2 (1 − cos 2Ω)
2[1 + β 2 (1 + α) 2 + α 2 − 2β(1 + α) 2 cos Ω + 2α cos 2Ω] , (3.13) which will go to zero at Ω = 0 and at Ω = π. A maximum value of unity is reached at Ω = Ω 0 , called the center frequency of the bandpass filter. This is then used in the project to get the value of β by β = cos(Ω 0 ). Where the squared magnitude response goes to 1/2, the frequencies Ω c1 and Ω c2 are called the 3-dB cutoff frequencies.
An advantage with IIR filters is that the number of computations for a given specification is less than corresponding FIR filter. The complexity is proportional to the length of the impulse response for an FIR filter, which is not the case for an IIR filter.
Disadvantages with IIR filters can be that IIR filters can not have linear phase. The closer phase linearity an IIR filter is, the longer it gets, because of the amount of phase parameters that have to be included. The group delay of IIR filters is not constant for all frequencies, which is why they cannot have linear phase. See section 3.5 for more about linear-phase filters. Another important disadvantage is that IIR filters can have stability problems. See more about stability in section 3.4.
In [5], [6], [7] and [8] this is discussed more thoroughly.
3.4 Stability
There are several different definitions for stability, and the most common one is a stable
system where every limited input has a limited output. This is called a BIBO system,
18 Signal Processing Theory
which stands for bounded input - bounded output. If the input is limited, |x(n)| ≤ K for every n, we have
|y[n]| =
∞
X
−∞
x[n − k]h[k]dk
≤
∞
X
−∞
|x[n − k]h[k]|dk =
∞
X
−∞
|x[n − k]||h[k]|dk ≤ K
∞
X
−∞
|h[k]|dk, (3.14)
where h[k] should be absolutely summable, i.e.
∞
X
k=−∞
|h[k]| < ∞. (3.15)
A necessary condition is h[k] → 0 when k → ∞ for (3.14) and (3.15) to be true.
To analyse and understand digital filters and stability, the z-transform is a very useful tool. Suppose an N times sampled signal with the period T that gives the sequence x[n] = {x 0 , x 1 , x 2 , x 3 , ..., x N −1 }. Applying the z-transform on the sequence x[n], gives X(z) = x 0 + x 1 z − 1 + x 2 z − 2 + ... + x N −1 z − (N −1) . This can also be written as
X(z) =
∞
X
n=−∞
x[n]z − n . (3.16)
To learn more about the z-transform, see for example [5].
Stability is an issue when dealing with IIR filters. An IIR filter can become unstable if the parameters are not in the right ranges. The bandpass filter used in the project looks like this:
H BP (Ω) = 1 2
1 − α − β(1 + α)e − jΩ + e − 2jΩ 1 − β(1 + α)e − jΩ + αe − 2jΩ
, (3.17)
where the filter is stable if |α| < 1. If α is not in the right boundaries then the poles will not be inside the unit circle and unstability will arise.
A digital FIR filter with bounded impulse response coefficients is always stable. This is because there is no feedback in FIR filters that can cause instability.
3.4.1 Poles and Zeros
A way of checking if a system is stable is by checking its poles and zeros. To decide
the poles and the zeros of a function, the transfer function is needed. The roots of the
3.4. Stability 19
−1 −0.5 0 0.5 1
−1
−0.8
−0.6
−0.4
−0.2 0 0.2 0.4 0.6 0.8 1
Real Part
Imaginary Part
Figure 3.4: Pole-zero plot with α = −0.8 and β = 15000. x=pole, o=zero.
numerator are the zeros and the roots of the denominator are the poles of the function.
Poles and zeros are complex and poles on the outside of the unit circle in a pole-zero plot indicate instability i.e., the poles must all have magnitude smaller than one for the system to be stable. The unit circle always has radius one. Zeros may lie inside, on, or outside the unit circle. All complex zeros and poles must occur in complex conjugate pairs in order for the filter coefficients to be real.
By using the MATLAB function zplane(b, a), where b and a are the numerator and denominator in the transfer function, a plot of the poles and the zeros of a system is created, see figure 3.4. If the poles are not inside the unit circle, the system is not stable.
In figure 3.4, the bandpass filter in equation (3.17) is executed. The poles are inside the unit circle, which indicates stability for this filter.
More information about stability, poles and zeros can be found in [9] and in [10].
20 Signal Processing Theory
3.5 Designing Filters
This section describes filter design in both the analog and digital case. Since the digital IIR bandpass filter used in this project is taken directly from a book [7] and not created manually, this chapter will briefly discuss different ways to proceed when creating a filter.
Analog filtering is applied to continuous-time signals and yields continuous-time signals.
Theoretically, analog filters have infinite frequency range, but in practice it is always limited. Analog filters have problems with nonlinearities, sensitivity to noise, dynamic range limitations, lack of flexibility, inaccuracies due to variations in component values and imperfect repeatability.
Digital filtering is applied to discrete-time signals and yields discrete-time signals. It is usually implemented in a computer or in a DSP (digital signal processor). The frequency range is always finite, and is limited to one-half of the sampling rate. Digital filters are accurate to any desired degree, are flexible, perfectly repeatable and they do not suffer from internal noise. Digital filtering requiers A/D and D/A conversion and care must be taken to avoid aliasing and operating frequency range is sometimes limited by the available computational speed.
Digital IIR filters can either be transformed from analog filters or created in the digi- tal domain directly. When designing filters there are a few different ways to proceed.
Methods that start with analog filters are:
• Impulse invariant method that gives IIR filter. The construction criteria is that the impulse response of the digital filter and the impulse response of the analog filter should be identical in the sampling moment. Assume given a real, causal, stable, rational filter H L (s) that will become H Z (z), which should be real, causal, stable and rational. It should have the same order as H L (s) and its frequency response should be close to that of the analog filter of interest. To find the digital filter’s transfer function we have h(t) that is the impulse response of an analog filter, and h[n] that is the impulse response of the desired digital filter. The impulse invariant method defines h[n] = T h(nT ). Proceed as follows to get the digital filter’s transfer function:
1. Compute the inverse Laplace transform of H L (s) to get h(t).
2. Sample the impulse response at interval T and multiply by T to obtain h[n].
3. Compute the z-transform of the sequence h[n] to get the transfer function
H Z (z).
3.5. Designing Filters 21
• Bilinear method that gives IIR filter. It is defined by the substitution s ← T 2 · z−1 z+1 . The transfer function of the corresponding digital filter given an analog filter H L (s), is H z (z) = H L (s)
s=
T2(z−1)(z+1).
• Windowing method that gives FIR filter. Similar to the impulse invariant method used to create an IIR filter. Proceed like this:
1. Start with the frequency response H(Ω) for an ideal lowpass filter.
2. Perfom the inverse discrete Fourier transform (DFT) of H(Ω) to get an infinite impulse response h[n].
3. Truncate h[n] by multiplication between h[n] and a finite time window w[n].
4. Rightshift the symmetrical impulse response to get a causal filter.
5. Perform a DFT on h[n] to get the transfer function H(Ω).
An approach for designing IIR filters from analog filters involves six steps:
1. Choose the analog filter model.
2. Calculate the model order and cutoff frequency.
3. Find the pole locations.
4. Factor the continuous-time transfer function.
5. Obtain a lowpass filter prototype.
6. Transform from lowpass filter prototype to desired lowpass, highpass, bandpass, or bandstop filter.
An example of how to design a filter: Convert the single-pole lowpass Butterworth filter with system function H(z) = 0.245(1+z 1−0.509z
−1−1) into a bandpass filter with upper and lower cutoff frequencies Ω u and Ω l . The lowpass filter has 3-dB bandwidth Ω p = 0.2π.
Solution: The desired transformation is z − 1 → − a z
−2− a
1z
−1+a
22
z
−2− a
1z
−1+1 , where
a 1 = −2αK/(K + 1), a 2 = (K − 1)/(K + 1), K = cot Ω
u− 2 Ω
ltan Ω 2
cand α = cos[(Ω cos[(Ω
uu+Ω − Ω
l)/2]
l
)/2] . Substitution into H(z) yields
H(z) =
0.245 h
1 − a z
−2− a
1z
−1+a
22