EE425 Lab 6-Discrete-time Series Averaging Filters -Part II Solved

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

Rate this product

Exp. 6: Discrete-time Series Averaging Filters -Part II Objective: Implementation of moving average filters with application to discrete-time series.

Consider the moving average filter given by:
y[n] = 𝑥[𝑛] + 𝑥[𝑛−1] + 𝑥[𝑛−2] + 𝑥[𝑛−3]

4

In Figure 1 we show the output time series yi[n], for i=1,…,4, produced by this filter when it is convolved with each of the five different periodic times series inputs xi[n], for i=1,…,4. In this figure, the inputs xi[n] are shown in blue, while the outputs yi[n] are shown in red, and it should be evident to you, by inspection, why we call such a filter a moving average filter: note how in Figure 1 all the outputs appear “smoother” than the inputs, in some sense. Indeed, averaging can be interpreted as a smoothing process.

Figure 1. Inputs xi[n] and outputs yi[n], for i=1,…,4.

IMPORTANT NOTE 1: Please note that the outputs yi[n] , for i=1,…,4, in Figure 1 are showing both the transient phase and the steady-state phase.

Task 1

  1. The first thing for you to do is to compile and simulate the given .asm template titled “ template_for_moving_average_Part_II.” While you do that, please note the following:
    1. The variable of interest in this template is, again, the register called value.
    2. Simulate the template as is (i.e., without making any changes) and note that the contentsof value are exactly the values for time series x1[n] shown in Figure 1.
  2. Go back to the template and locate the sections of code shown in Figures 2 and 3.Figure 2. counter variable, where the literal 2 is the period of time series x1[n].

    Figure 3. Periodic time series of different periods.

  1. Consider Figures 2 and 3, and perform the following changes in the template:
    1. Corresponding to Figure 2, replace the literal 2 with the new literal 4. This new literal 4 is simply the period of the second time series x2[n], of period 4, shown in the code inFigure 3.
    2. Corresponding to Figure 3, comment out the following lines of code, which correspondto time series x1[n]:
      1. SimpleTable; —> period 2,
      2. db 80,240
    3. Corresponding to Figure 3, uncomment the following lines of code, which correspond to time series x2[n]:
      1. ;SimpleTable ; —> period 4
      2. ;db 80,240,160,60
  2. Simulate the code again, with the changes made in step 3, and note how the contents of registervalue change according to the time series x2[n], also shown in Figure 1.
  3. Repeat step 3 above for each of the remaining time series in Figure 3 and note that the contents of value will vary according to the time series that you choose. All the available time series in the template are shown in the time domain in Figure 1 as xi[n], for i=1,…,4, and shown in code in Figure 3. Each time series has a different period, please verify this through simulations before moving on to the next task.

Task 2

1. Having completed Task 1, please write the .asm code to implement the moving average filter y[n] specified above.

a. Convolve your implemented filter with each of the time series xi[n], for i=1,…,4, in the template, one at a time, of course.

  1. Note that this Task is an extension of your work for Lab 5.
  2. You must implement a linear memory buffer exactly like the one that you wrote forLab 5.
  3. Just like for the filter in Lab 5, you should also add all the values first, and then“divide” the entire sum after (in this case it will be “division” by 4). Note that now you will be adding four (4) variables and not just two (2) like in Lab 5. Consequently, your adder/divider from Lab 5 will have to be extended to account for this. Recall

    There are many ways to perform this addition. I suggest that you draw out the process on a piece of paper, before writing any code, to

    help you get your ideas straight and so that you can get a clear idea of what you are trying to do here. Note that this adder/divider is not a difficult thing to do, but you really have to be clear on what is going on when you are trying to add four variables (two at a time), considering that each of these variables is 8 bits long.

b. Verify that your filter was properly implemented by comparing your results with each output yi[n], for i=1,…,4, in Figure 1. In order to help you keep track of all the values, you should create a table for each pair xi[n] and yi[n] as shown in Table 1 for x1[n].

that addition can only be performed with two registers at a time. This means that you

may want to create additional variables to help you keep track of the full sum, which

will necessarily span two registers.

c. For this task, you should fill up the tables for each pair on your own, by hand, before implementing the filter. This is so that you know what outputs to expect (Hint: see Figure 1). Include all tables in your report.

n … k k+1 k+2 k+3 k+4 k+5 k+6 k+7 k+8 k+9 k+10 k+11 … x1[n] … 180 240 180 240 180 240 180 240 180 240 180 240 … y1[n] … 210 210 210 210 210 210 210 210 210 210 210 210 …

Table 1. Periodic discrete-time series input x1[n] and corresponding output y1[n]. IMPORTANT NOTE 2: Please note that the output y1[n], in Table 1, is only showing the

steady-state phase, and not the transient phase.

IMPORTANT NOTE 3: The remaining tasks in this assignment are simple extensions of your work in Task 2. Thus, it is important that you simulate your code for Task 2 extensively to make sure that it is correct. If you do that, then the following tasks will only require trivial changes to the code that you wrote for Task 2. Furthermore, you should take advantage of the simulator and use it to generate the values for the tables (similar to Table 1) for all the cases below. In short, for the following tasks, you should not be calculating the values for the desired tables by hand anymore. Instead, use the simulator and just fill up the tables with the values it generates!

Task 3
2. Repeat Task 2 for the following moving average filter A[n]:

A[n] = 𝑥[𝑛] + 𝑥[𝑛−2] + 𝑥[𝑛−4] + 𝑥[𝑛−6] 4

Task 4
3. Repeat Task 2 for the following moving average filter B[n]:

B[n] = 𝑥[𝑛] + 𝑥[𝑛−3] + 𝑥[𝑛−6] + 𝑥[𝑛−9] 4

Task 5
4. Choose three arbitrary and distinct positive integers j, k, and l, each no greater than 15, and then

repeat Task 2 for the following moving average filter C[n]:

C[n] = 𝑥[𝑛] + 𝑥[𝑛−𝑗] + 𝑥[𝑛−𝑘] + 𝑥[𝑛−𝑙] 4

  • Lab_6-6qilj7.zip