Starting from:

$35

ASAS Homework 2: Convolution and Linear Time-invariant Filtering Solved

 ASAS Homework 2: Convolution and Linear Time-invariant Filtering 
1. Averaging and “differencing” (Remarks: Yes, here we are going to use “difference” as a verb). Please first find a piece of music or any sound and read it into MATLAB. Denote the signal as π‘₯[𝑛].

(a)  Check the sampling rate, the number of channels, and the number of bits per sample.

(b) The simplest low-pass filter is to average over consecutive samples; that is, let

                                                           1      !

                                                                               π‘¦[𝑛] =+   π‘₯[𝑛 − π‘š + 1] ,

                                                           π‘       "#$

where 𝑝 is the order of the filter, and 𝑦[𝑛] is the output of the filter. Implement this filter and listen to the output. Increase 𝑝 from 1 to 10 to see if you can hear the difference.

(c)  Check your result in (b) against the following results. They should essentially be identical.

 y_conv = conv(x, 1/p*ones(p,1)); 

(d) In fact, the array 1/p*ones(p,1) can be regarded as the impulse response of this FIR

(finite impulse-response) filter. Denote h = 1/p*ones(p,1) and use freqz(h) to plot the frequency response of the filter.

(e)  Now, define 𝑦% = π‘₯[𝑛] − π‘₯[𝑛 − 1]. Of course this can be done with a “for” loop, but alternatively, please use conv() to do the job.

(f)   Set x = 0.1*randn(A_CERTAIN_LENGTH, 1) so it is an instance of Gaussian white noise with mean zero and standard deviation 𝜎 = 0.1. Listen and compare the result before and after averaging/differencing. Does it feel more unpleasant before or after averaging/differencing? Describe how you feel about it and explain, perhaps, the reason why.

Remark: When you listening to a signal stored in a vector, make sure that its range is between ±1 to avoid clipping effect. Or, alternatively, use soundsc() to avoid clipping. Always remember to specify the sampling rate.

 

2. Infinite impulse response (IIR). Take any audio signal π‘₯[𝑛] and for any 𝑛 1 implement the following by a for loop,

𝑦[𝑛] = 𝛼𝑦[𝑛 − 1] + π‘₯[𝑛],

          Where 0 < |𝛼| < 1 is a constant. You can assume 𝑦[1] = 0.

(a)  Check your result against y = filter([1], [1 -alpha], x).

(b) Create an instance of Gaussian white noise for about 1 second long. Listen and compare the result before and after filtering. (c) Create a periodic impulse train:

                                               π‘₯[𝑛] = 700.5, ,                        otherwiseif     𝑛 = 80.π‘š

Where π‘š is an integer. In other words, π‘₯[𝑛] is non-zero at every 80th sample. Listen and compare the result before and after filtering.  

(d) Discuss how to restore π‘₯[𝑛] from 𝑦[𝑛]. (Hint: if 𝛼 is known, it is quite easy. However, if 𝛼 is unknown, you may need to make assumptions.)


More products