Some of the methods yield a linear convolution, and some do not. With an input signal of 24 samples in length and a filter with an impulse response of 16 samples in length, the linear convolution would be 39 samples in length (i.e., 24 + 16 - 1).
For the FFT-based method, the length of the FFT determines the length of the filtered result. An FFT length of less than 39 would yield a convolution, but it wouldn't be linear convolution. Convolution computed using the FFT is called circular convolution. When the FFT length is long enough, the answer computed by circular convolution is the same as by linear convolution.
Consider the case when the filter is a block in a block diagram, as would be found in Simulink or LabVIEW. When executing, the filter block would take in one sample from the input and produce one sample on the output. How would the scheduler know how many times to execute the block? As many times as there are samples on the input arc. How many samples would be produced? As many times as the block would be executed.
freqresp.m
will implement
the Matlab function freqresp
.
Please put these .m files on your path.
A convenient place is the current working directory.
The following Matlab commands may be useful:
cd
: change directories (without an argument,
it prints the working directory)
dir
: lists the contents of the current working
directory
pwd
: prints working directory
In the cases for which one cannot find the frequency response by simply substituting z = exp(j w), one can use the discrete-time Fourier transform (see slide 5-8). Using the discrete-time Fourier transform may require you to search in other books, e.g. Discrete-Time Signal Processing by A. V. Oppenheim and R. W. Schafer. Another option is to use Mathematica to compute the discrete-time Fourier transform for the discrete-time signal. To run Mathematica, login to sunfire1 or sunfire2 and type "math", and then cut-and-paste the following commands to find the discrete-time Fourier transform for problem 2.1(d):
AppendTo[ $Path, "/home/ecelrc/faculty/bevans" ]; Needs[ "SignalProcessing`Master`" ]; First[ DiscreteTimeFourierTransform[ Cos[w0 n] DiscreteStep[n], n, w ] ]For problem 2.1(c),
First[ DiscreteTimeFourierTransform[ DiscreteStep[n], n, w ] ]
The Matlab command filtdemo
will provide a graphical user interface for designing filters.
The filtdemo requires seven parameters: filter design method,
maximum passband frequency, passband magnitude tolerance,
minimum stopband frequency, stopband magnitude tolerance,
sampling rate, and filter order. The statement of problem 2.4
gives the filter design parameters to use in filtdemo
.
In order to run Matlab remotely, run X windows on your local machine, login into sunapp1.ece.utexas.edu or sunapp2.ece.utexas.edu, using secure shell (ssh) and then run Matlab:
matlab &If Matlab will not run due to an improper DISPLAY variable, then run the following on either sunapp machine:
source ~bevans/setdThere are many X windows emulators for PCs and Macs, including
specnoise.m
will implement
the Matlab function specnoise
.
Place the file specnoise.m
on the Matlab path.
A convenient place is the current working directory.
The following Matlab commands may be useful:
cd
: change directories (without an argument,
it prints the working directory)
dir
: lists the contents of the current working
directory
pwd
: prints working directory
filtdemo
will provide a graphical user interface for designing filters.
The filtdemo requires seven parameters:
filtdemo
.
Be sure to check the graphical view of the passband and stopband to
make sure that each of the three filter designs meets specifications.
If you are not absolutely sure, then you can compute the magnitude
response is at a particular frequency using the freqz
function in Matlab. The arguments are the filter transfer
function (type help filtdemo
to find out how to
obtain the transfer function of the current design) and the
frequency in Hz. Then, you can take the magnitude of the result.
Finally, you'll need to convert the magnitude to dB using
20 log10 magnitude. For more information on
freqz
, type help freqz
in Matlab.
In order to run Matlab remotely, run X windows on your local machine, login into sunapp1.ece.utexas.edu or sunapp2.ece.utexas.edu, and then run Matlab:
matlab &If Matlab will not run due to an improper DISPLAY variable, then run the following on sunapp1:
source ~bevans/setdThere are a variety of X windows emulators, including
You do not have to write any assembly language code for this problem. To compute one output sample of an FIR filter, one needs to compute the vector dot product of the vector of FIR coefficients and the vector of the current and the previous N - 1 input values. In lecture 1, we discussed the rough outline of an assembly function to compute one output value of an FIR filter: