EE 5410 Signal Processing MATLAB Exercise 2
Sinusoidal Interference Cancellation
Intended Learning Outcomes:
On completion of this MATLAB exercise, you should be able to Analyze discrete-time signals in the frequency domain
Design and implement a digital filter for suppressing a sinusoidal interference
Deliverable:
Each student is required to submit a hardcopy answer sheet which contains only answers to the questions in this manual on or before 7 November 2018.
Background:
A typical application area for least squares filter is interference cancelling. Here, the task is to remove a noise or interference signal with the use of an external reference and its block diagram is shown in Figure 1.
Figure 1: Digital filter for removing an interference
Interference cancelling principle is applicable in cases where there is a signal s[k] embedded in an interference n[k] , together with a reference source of the interference n'[k]. The problem of interference suppression is formulated as follows. Given
r[k] = s[k] + n[k ] and n'[k], k = 0,1,, N −1
The task is to recover s[k]. The n[k] and n'[k] are correlated in the sense that n[k]
can be modelled as a linear combination of n'[k]:
L −1
n[k]= ∑ cin'[k−i]
i=0
where {ci } are unknown. Based on the technique of least squares filtering [1], the
{ ci } are estimated as:
1
N −1 L−1 2
~ {cˆi}=argmin∑ r[k]−∑ cin'[k−i]
~ {ci}
k=0 i=0 The recovered signal is then calculated as
L −1
sˆ [ k ] = r [ k ] − ∑ cˆ i n ‘ [ k − i ]
i=0
In telecommunication, a typical application example of interference cancelling is
echo cancellation where r[k] contains both the near-end and far-end talker signals while n'[k] is a reference source of the far-end talker signal [2]. Furthermore, in
biomedical engineering, a well-known example is in electrocardiogram (ECG) recording where r[k] is an ECG signal corrupted by a 50 Hz power line interference
while n'[k] is another 50 Hz signal with different amplitude and phase [3]. Procedure:
- Download the file “one2nine.txt” at [4]. This file contains the waveform of the numbers “1” to “9” and the sampling frequency is 22000 Hz. Try the following MATLAB code
load one2nine.txt soundsc(one2nine, 22000)
Examine the operation of the commands. Change the number “22000” to “10000” and “40000”. What do you hear for the three cases? Briefly explain the differences.
- Download the file “message.txt” at [4]. This file contains the waveform of a voice message embedded in a sinusoid with frequency of 300 Hz, and the sampling frequency is 22000 Hz. Construct a least squares filter to recover the speech using the following steps:
- (a) Try the following MATLAB code
load message.txt soundsc(message, 22000)
What do you hear? Can you hear the speech?
- (b) Try the following MATLAB code to observe the spectrum of message:
[freq_resp,freq_index]=freqz(message,1,50000,22000); plot(freq_index,abs(freq_resp))
You will see the magnitude plot of the Fourier transform for message versus frequency in Hz. The dominant frequency component of message corresponds to the peak of the magnitude spectrum. Write down the dominant frequency with the use of the command max. For more information, try help freqz and help max.
- (a) Try the following MATLAB code
2
(c) Since the interference is a sinusoid, it should be of the form: n(t) = Acos(ωt + φ)
where ω = 600π while the amplitude A and the phase φ are unknown. After sampling, the discrete-time interference signal is:
n[k] = Acos(ωkTs + φ)
where Ts =1/22000. From trigonometric identities, n[k] can be written as:
n[k] = Acos(φ)cos(ωkTs ) − Asin(φ)sin(ωkTs ) =αn’1[k]+βn’2 [k]
where n’1 [k] = cos(ωkTs ) and n’2 [k] = sin(ωkTs ) are known which can be considered as reference sources for n[k] while α = Acos(φ) and
β = −Asin(φ) are the unknown weights to be squares estimates for α and β are obtained from:
determined. The least
and
ˆ N−1 ~ ~ 2 {αˆ,β}=argmin ∑ (r[k]−αn’ [k]−βn’ [k])
~~k=0 1 2 {α,β}
where r[k] corresponds to message. That is, αˆ and βˆ are solved via differentiating the least squares cost function with respect to α~ and β~ and
then setting the resultant expressions to zero:
∂N−1 ~ ~ 2 ~ ∑ (r[k]−αn’1[k]−βn’2[k])
=0 =0
∂αk=0
~ ~ˆ α = αˆ , β = β
~ ~ˆ α = αˆ , β = β
∂N−1 ~ ~ 2 ~ ∑ (r[k]−αn’1[k]−βn’2[k])
∂βk=0
Solve the above two equations. Then write down the estimates of the unknown weights. Note that the summation starts from . Use length(message) to determine the appropriate signal length, that is, the value of .
(d) After obtaining αˆ and βˆ , write MATLAB code to construct the recovered speech according to
ˆ
sˆ [ k ] = r [ k ] − αˆ n ‘ 1 [ k ] − β n ‘ 2 [ k ]
Determine the speech content.
References:
[1] S.D.Stearns and D.R.Hush, Digital Signal Processing with Examples in
MATLAB, CRC Press, 2011
- [2] S.Haykin, Adaptive Filter Theory, Pearson, 2014
- [3] B.Widrow and S.D.Stearns, Adaptive Signal Processing, Prentice Hall, 1985
[4] http://www.ee.cityu.edu.hk/~hcso/ee5410.html
3