Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

EE 5410 Signal Processing

MATLAB Exercise 2

Sinusoidal Interference Cancellation

Intended Learning Outcomes:

On completion of this MATLAB exercise, you should be able to

1 Analyze discrete-time signals in the frequency domain

1 Design and implement a digital filter for suppressing a sinusoidal interference

Deliverable:

1 Each student is required to submit an answer sheet which contains only answers

to the questions in this document on or before 4 November 2022Background:

Interference cancellation is a typical application of least squares systems. Here, we want 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: Discrete-time system for removing an interference

Interference cancelling principle is applicable in cases where there is a signal

embedded   in  an   interference           ,  together  with   a   reference   source   of  the

interference

Given 

The task  is to  recover       . The         and         are dependent or correlated  in the

sense that         can be modelled as a linear combination of :

 

Based on the technique of least squares [1],  are computed as:

 

where    denotes the estimate of   . The recovered signal, denoted by      , is then

calculated as:

 

In telecommunications,  a typical application example of  interference  cancelling  is echo cancellation where       contains both the near-end and far-end talker signals

while          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       is an ECG signal corrupted by a 50 Hz power line interference while  is another 50 Hz signal with different amplitude and phase [3].

Procedure:

1.   An application for spectral analysis in the field of astronomy is to find the sunspot cycle  using  the  sunspot  number  [4].  Download  SN_m_tot_V2.0.txt”  at  [4]. Remove “*” and then save it as “spot_num.txt” . Try the following code:

load spot_num.txt

ssn = spot_num(:,4);

ssn = ssn-mean(ssn);

[freq_resp,freq_index]=freqz(ssn,1,50000,1);

plot(freq_index,abs(freq_resp))

(a)       Examine the operation of the commands. From the plot, write down the

dominant frequency which  is relative to one  month, with the use of the command  max.  For  more  information  on  these  commands,  try  help freqz and help max.

(b)       Based on the result of (a), determine the sunspot cycle estimate in terms

of number of months.

(c)       What is the purpose of the command ssn = ssn-mean(ssn)?

2.   Download the file message.txt” at Canvas. 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.

(c)      Since the interference is a sinusoid, it should be of the form:

 

where                  while  the  amplitude     and  phase     are  unknown. After

sampling, the discrete-time interference signal is:

 

sec. Using trigonometric identities,  can be written

 

where                               and                              are  known  which  can  be

considered   as   reference   sources   for             while                           and

are  the  unknown  weights  to  be  determined.  The  least squares estimates for  and  are obtained from:

 

where         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. That is:

 

and

 

Solve the  above  system  of  linear equations with two  unknowns.  Then write  down  the  estimates  of  the  two  unknown  weights.  Note  that  the

summation  starts  from             and  you  can  use  length(message) to

determine the appropriate signal length, that is, the value of  .

(d)      After obtaining    and    , write  MATLAB  code to  construct the  cleaned speech according to

 

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]   https://solarscience.msfc.nasa.gov/SunspotCycle.shtml