0% found this document useful (0 votes)
222 views

DSP Filter Design With Sptool Matlab

The document describes a lab experiment on filter design using SPTool. The objectives are to import and name a signal, design a filter, apply the filter to the signal, and view and compare the original and filtered signals in the time and frequency domains. First, a speech signal is imported and a filter with one zero at π and one pole at the origin is designed. Then, the filter is applied to the speech signal to create a filtered signal. Finally, the original and filtered signals are viewed in the time and frequency domains using various tools in SPTool to analyze and compare the effects of the filter.

Uploaded by

Zain Ali
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
222 views

DSP Filter Design With Sptool Matlab

The document describes a lab experiment on filter design using SPTool. The objectives are to import and name a signal, design a filter, apply the filter to the signal, and view and compare the original and filtered signals in the time and frequency domains. First, a speech signal is imported and a filter with one zero at π and one pole at the origin is designed. Then, the filter is applied to the speech signal to create a filtered signal. Finally, the original and filtered signals are viewed in the time and frequency domains using various tools in SPTool to analyze and compare the effects of the filter.

Uploaded by

Zain Ali
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

Center of Advanced Studies in

Engineering, Islamabad

Lab # 8
Filter Design with SPTool

Name of student: __________________________________________________________


Roll No.: ________________________________________________________________
Date of Experiment: _______________________________________________________
Report submitted on: _______________________________________________________

Marks obtained: ______________________


Instructor Signature: ______________________

Digital Signal Processing Lab

Filter Design with SPTool


1. Objective
1.1

Importing and naming a signal using SPTool

1.2

Designing a filter using the Filter Designer

1.3

In SPTool, applying the filter to the signal to create another signal

1.4

Viewing the time domain information of the original and filtered signals using the
Signal Browser

1.5

Comparing the spectra of both signals using the Spectrum Viewer

2. Overview
SPTool is a complete GUI-based interactive tool to design and implement digital
filters. It combines with a set of tools to perform the all steps of designing and analyzing the
signal and filter in both frequency and time domains.
2.1

Create, Import, and Name a Signal


You can import an existing signal into SPTool, or you can create a new signal and edit

and name it in SPTool. In this step, youll create a new signal at the command line and then
import it into SPTool.
1.

At the command line, create a speech signal


[speech,fs]=wavread(sppech.wav);

2.

Activate SPTool by typing


sptool

The SPTool window is displayed.


3.

Select Import... from the File menu:


The Import to SPTool window is displayed.
Notice that the variable x is displayed in the Workspace Contents list. (If it is not,

click the From Workspace radio button to display the contents of the workspace.)
4.

Name the signal and import it into SPTool:


a)

Make sure that Signal is selected in the Import As pop-up menu.

b)

Click in the Data field and type speech.

You can also move the variable speech into the Data field by clicking on speech
in the Workspace Contents list and then clicking on the arrow to the left of the
Data field.

C@SE

c)

Similarly Sampling Frequency field provide fs from workspace.

d)

Name the signal by clicking in the Name field and typing speech.

e)

Press OK.

Digital Signal Processing Lab


The SPTool window is reactivated, and the signal speech[vector] is selected in the
Signals list.

2.2

Design a Filter
You can import an existing filter into SPTool, or you can design and edit a new filter

using the Filter Designer. In this step, youll create a new filter. You will start designing by
taking one pole at origin and zero at . Which is a basic example covered in lecture.
1.

Press New Design in SPTool to activate the Filter Designer and generate a
default filter.

2.

The Filter Designer window is displayed with the default filter filt1.

3.

Change the filter sampling frequency to fs by typing fs in the Sampling


Frequency text box in the Filter Designer.

4.

Specify the filter parameters:


a. Make sure Pole/zero editor is selected in the Algorithm pop-up menu.
b. Now, firstly clear al zeros and poles from already designed filter.
c. Place one zero with mag = 0.9 & angle=pi and a pole mag & angle = 0
Now, you have designed a simple filter.
d. Click the send back button. Now it is ready for analysis in SPTool main menu.

C@SE

Digital Signal Processing Lab

When the new filter is computed, the magnitude response of the filter is displayed with a
solid line in the main axes display area. To bring the responses for the first time click on the
view button in main SPTool menu.
2.3

Apply the Filter to a Signal


In this step, you apply the filter to the signal in SPTool. The new, filtered signal is

automatically created in SPTool:


1.

Activate SPTool from the Window menu in the Filter Designer.

2.

Click to select the signal speech[vector] from the Signals list and click to
select the filter (named filt1[design]) from the Filters list.

3.

Press Apply to apply the filter filt1 to the signal speech.

4.

The Apply Filter dialog box is displayed.

5.

Name the new signal by clicking in the Output Signal field and typing
filsp.

6.

Press OK.

The filter is applied to the selected signal. The new, filtered signal filsp[vector] is
displayed in the Signals list.
2.4

C@SE

View, Play, and Print the Signals

Digital Signal Processing Lab


You can view and print the time domain information of the signals using the Signal
Browser. You can also play the signals. In this step, youll display both signals in the Signal
Browser, select and play each signal:
1.

Shift + click on the speech and filsp signals in the Signals list of SPTool to
select both signals.

2.

Press View in the Signals panel.

3.

The signal thats displayed in the Selection pop-up menu and in the

4.

Selection display is the active signal. When you select Play.

Compare Spectra of Both Signals

2.5

You can get an idea of the frequency content of the two signals by displaying their
power spectra using the Spectrum Viewer, as described below:
1.

Reactivate SPTool by selecting it from the Window menu of the Signal Browser.

2.

Click on the speech[vector] signal in the Signals list of SPTool to select it.

3.

Press Create in the Spectra panel.

The Spectrum Viewer is activated, and a spectrum object (spect1) corresponding to


the noise signal is created in the Spectra list. Choose FFT in method menu. And type
2048 in Nfft. The spectrum is not computed or displayed yet.
4.

Press Apply in the Spectrum Viewer to compute and display spect1. The
spectrum of the speech signal is displayed in the main axes display area.

Exercise
1. Generate a sinusoid of 2 KHz, 5 KHz & 8 KHz.
2. Add them all & import the signal in SPTOOL.
3. Design a LPF which eliminates all the frequencies.
Lab Assignment
1. Design a band stop filter having a Bandwidth of 100 Hz. Order of the filter be 5. Initial
cutoff frequency is 4 KHz. While the sampling frequency is 32 KHz.
2. Place poles in the exact same location of the zeros above and see what happens.

C@SE

Digital Signal Processing Lab

Center for Advance Studies in Engineering,


Islamabad Digital Signal Processing Lab 8
Rubrics of Lab Experiment
Rubric:1. Software optimization
1 Mark(s)
Good: Maximum output with minimal time and resources.
Satisfactory: Output generation with partial resource management.
Poor: Output generation with waste of resources
Rubric:2. Code formatting and descriptive variable name
2 Mark(s)
Good: Proper formatting of code with descriptive variable names.
Satisfactory: Partial formatting of code with partially descriptive variable names.
Poor: No formatting of code without descriptive variable names.
Rubric:3. Teamwork
2 Mark(s)
Good: Proper role identification with effective team discussion.
Satisfactory: Mix roles identification with ineffective team discussion.
Poor: No role identification without team discussion.
1 Mark(s)
Rubric:4.
Lab Report/Assignment
Good: Properly formatted with all the queries answered in a thoughtful manner.
Satisfactory: Partially formatted with incomplete answers.
Poor: Unformatted and wrong answers.
Rubric:5. Task Completion
4 Mark(s)
Good: Task completed by meeting all requirements.
Satisfactory: Partially complete task.
Poor: Incomplete task without meeting any requirements.

Rubric
#

Good

Satisfactory

Poor

1
2
3
4
5
Points
Total

C@SE

You might also like