Essay ECET 350 Topic 5 Lab DeVry

Essay ECET 350 Topic 5 Lab DeVry

Essay ECET 350 Topic 5 Lab DeVry
Essay ECET 350 Topic 5 Lab DeVry

ECET 350 Topic 5 Lab DeVry

ECET 350 Topic 5 Lab 5 Matlab Designed Band Pass Finite Impulse Response Filters

Objectives

  • Design a high order, FIR band pass using Matlab, and analyze the performance of that filter

Software Needed

  • Lab 5 Band Pass FIR, available in the Files section of the Course Menu
  • Excel
  • Matlab with Signal Processing Toolbox

Answer all questions, complete all tables, and paste all figures and graphs in the Week 5 Lab Cover Sheet (Links to an external site.).

Submit your Week 5 Lab Cover Sheet for grading.

You can also download the Week 5 Lab Cover Sheet for the Week 5 Lab in the Files section of the Course Menu.

This lab uses the Parks-McClellan FIR design algorithm within Matlab to create a relatively high-order bandpass FIR filter that is to be designed according to specifications given in this handout.

You are to design a band pass FIR filter using the Sptools Matlab toolbox according to the following specification. Unlike the windowed, impulse response method discussed in the textbook and implemented in the previous lab, Matlab uses a completely different algorithm called the Parks-McClellan filter design algorithm.

This algorithm is an iterative algorithm, meaning it performs the filter coefficient calculations repeatedly, comparing the design results with a predetermined error factor until the design results are below the error factor. The Parks-McClellan algorithm is very efficient, usually obtaining the desired design criteria with 10 to 12 iterations of the design loop and error process.

The specification for the filter is shown below. Please note that the specifications correspond directly to parameters that are to be entered in the Matlab Sptool graphical filter design program.

Filter Type:Equiripple Band pass
Filter Order:Minimum Order
Frequency Specification
Units:Hertz
Fs (Sampling Frequency):2000
Fstop1:380
Fpass1:400
Fpass2:600
Fstop2:620
Magnitude Specifications
Units:dB
Astop1(stop band attenuation below Fstop1):40
Apass(pass band ripple):1
Astop2(stop band attenuation above Fstop2):40

Once you have opened Matlab, you will need to open the signal processing toolbox. To do so, from the Matlab command window, type Sptool, and then press enter. The Sptool session window, shown in Figure 1, should now open. In the filters column, click on New. This should now open the filter designer window as shown in Figure 2.

Figure 1: Sptool Session Start-Up Window

Figure 2: Filter Designer Window

Reopen the Sptool session window and click on file | save session as and save your filter design to a location of your choice for later reference. Please name your filter design session, but please note that Matlab does not accept long file names or file names with spaces in them.

Next, while still in the Sptool window, move the cursor to the filters field and click on filt1[design]. Next, click on edit|name and select filt1. Enter a descriptive name for your filter. Again, please note that Matlab is fussy about file names so no spaces or special characters may be used, and it is recommended you use the same name as your saved session name.

Reopen the filter designer window and using the parameters provided in the previous section of this lab, enter the band pass filter design parameters in the appropriate boxes as shown in Figure 2. Please check your entries, and once you have verified all parameters are correct, click the Design Filter button at the bottom of the window.

Figure 3: Filter Designer Band Pass Filter Results

The filter designer window should now change to a graph of your designed filter’s response as shown in Figure 3.

Leave the filter designer window open, but click on the Sptool session window and select the name of your filter in the Filters column.

Click on View, and a new window as shown in Figure 4 should appear with a new magnitude plot of your filter. Click on Edit in the menu bar, and then edit the title of the graph to ECET350 Lab 5 Band Pass Magnitude Response (dB). Copy and paste this graph into your Week 5 Lab Cover Sheet—Graph 1: FIR Band Pass Filter Frequency Magnitude Response Graph.

Figure 4: FIR Band Pass Magnitude Response View

Next, click on analysis and select phase response on the drop-down menu. A new window with a plot of the phase response of your filter should appear as shown in Figure 5. Edit the title of this graph as well to state ECET350 Lab 5 Band Pass Phase Response. Copy and paste this graph into your Week 5 Lab Cover Sheet—Graph 2: FIR Band Pass Filter Phase Response Graph.

To obtain the actual filter coefficients generated by the filter designer, reopen the Sptool session window. Make sure that your filter is selected and highlighted in the filters column and then click on the file menu bar item. Once the menu opens, select the export function as shown in Figure 6.

Once the export window opens, make sure that ONLY your filter is highlighted in the export list, as shown in Figure 7. Also, make sure that the export filters as TF objects is unchecked . Once you have verified this, click on the export to workspace button to export the filter coefficients into the Matlab workspace window.

Figure 5: FIR Band Pass Phase Response View

Figure 6: Sptool Session Export Menu

Figure 7: Export Filter to Workspace Window

Once the export is complete, open the Matlab workspace and type the name of your filter appended with .tf.num. For example, if your filter design name was MyBPFIR, then enter MyBPFIR.tf.num and then press enter. A listing of your filter coefficients should scroll by on the screen as shown in Figure 8.

Figure 8: Exported Filter Coefficients—Floating Point

You should note that all of the filters are listed as floating point numbers. However, for this high of an order digital filter, there is a good possibility that using floating point emulation on the Tower system may take too long and corrupt the filter output. The next steps then involve converting the coefficients to a fixed-point representation and then exporting the coefficients to a text file, which could be copied into your CodeWarrior source code and filter coefficients array.

To convert the floating point coefficients to fixed point, enter the following command in the Matlab command window, substituting your filter name for filt1.

coefs = round(filt1.tf.num * 2^15) <ENTER>

This command takes the floating point coefficients, which are all less than 1.0, and multiplies them by 2 raised to the 15 thpower, which performs the proper integer scaling for the 9S12 fixed-point math operations. The command then rounds them to the nearest integer value and saves them in the new vector called coefs. After you have entered this command, the new integer values should appear in the Matlab workspace window.

Before you can save your coefficients to a file, you will need to change the output directory of Matlab. At the top of the Matlab workspace, change the current directory by clicking the browse (three dots …) button to change the directory to a location of your choice, such as your flash drive. After you have done this, save the filter coefficients in a comma-separated, variable (csv) text file by entering the following command.

csvwrite (‘filtcoef.txt’, coefs) <ENTER>

Examine your file save location, and you should now see the file filtcoef.txt. Open the file with a text editor, such as Notepad, and then copy and paste the filter coefficients into your Week 5 Lab Cover Sheet—Listing 1: FIR Band Pass Filter Coefficients.

Guaranteed A+

Stop Stressing. Your Academic Success is Guaranteed.

Domyassignment is your direct route to higher grades. Thousands of students trust our PhD-level experts to deliver 100% original, custom-written papers—from tough essays to massive dissertations.

Zero Plagiarism (Free Report)
On-Time Delivery
Free Unlimited Revisions
100% Confidential
Secure Your Paper Now
Trusted by 50,000+ Students | Approved Essay Writers | A+ Guarantee
Scroll to Top