zplaneplots the poles and zeros of a transfer function in the z-domain. The Matlab command
freqzplots the magnitude and phase response for a given transfer function.
Hfreq(w) = H(z) | z = exp(j w)
Using the discrete-time Fourier transform may require you to search for the answer in books, e.g. Linear Systems and Signals by B. P. Lathi (chapter 9) or Signals and Systems by M. J. Roberts (section 5.6) or Signals and Systems by A. V. Oppenheim and A. S. Willsky (section 5.6). Recall that the discrete-time Fourier domain is periodic with period 2 pi.
This problem asks you to design a linear time-invariant filter
for the gong signal.
One possibility is to use a finite impulse response (FIR) filter
designed using the Parks-McClellan algorithm via the
firpm command in MATLAB.
This firpm command is introduced on pages 47 and 48.
(Octave users should see the footnote on page viii of JSK.)
Here is an example template of code to design such a filter
to be used immediately after running the MATLAB command
%% Nyquist frequency, i.e. half the sampling rate sr %% Sampling rate sr of the sound card is set when reading the %% gong file using the wavread command. fnyquist = sr/2; %% Define the passband frequency in Hz fpassband = ??; %% Define the stopband frequency in Hz fstopband = ??; ctfrequencies = [0 fpassband fstopband fnyquist]; pmfrequencies = ctfrequencies / fnyquist; %% Number of coefficients is filter order plus one filterorder = ??; lowpassamps = [ 1 1 0 0 ]; lowpassfilter = firpm( filterorder, pmfrequencies, lowpassamps );
There are many possible values for the passband frequency, stopband frequency and filter length. Please fill in your choices in the above code template.
Once the FIR filter coefficients have been computed,
you could filter the gong signal by using the MATLAB command
You could analyze the resulting signal using the
plotspec function from the MATLAB files that accompany
the Software Receiver Design book.
For those using Matlab remotely, you could use the wavwrite
command in Matlab to save the signal in wave format and then
transfer the wave file back to your computer for playback.
For secure file transfer, you could use Secure Shell (SSH),
which is available as a free download on the UT Austin
In problem 2.2(e), play back the downsampled filtered signal
at the same sampling rate as the original gong file.
The Matlab code to downsample a vector
vec by 2
vecDownsampledBy2 = vec(1:2:length(vec));
For least squares filter design, you might consider using the
Matlab command firls to obtain the filter coefficients instead of
The usage is very similar to
firpm (remez) you used in
Once you've designed the filter, you can use
plot the the magnitude response.
The advantage of this method is that you can tweak the filter
order and re-run simulations until the filter specification is met.
In certain versions of fdatool, the specification for the Kaiser window method uses cutoff frequencies instead of passband and stopband frequencies. The cutoff frequency is the value of the magnitude response that half of the passband magnitude response, or equivalently 6 dB less than the passband magnitude response. You can estimate the cutoff frequency as the average frequency in transition band, i.e. Fc1 = 3.5 Hz and Fc2 = 42.5 Hz in this problem.
For the Kaiser window method in fdatool, you could use the baseline filter order as a reference. Instead of playing with the filter order itself, I would recommend changing the filter parameters entered in the design tool to see if a lower filter order can be obtained. Instead of making the filter parameters more difficult to meet, one could decrease the stopband attenuation and increase the passband ripple.
You can validate a filter designed in fdatool by zooming into the magnitude response to check the magnitude response in dB at the stopband and passband frequencies, as well as at DC.
(b) In fdatool, you can plot the impulse response by choosing the
appropriate option under the Analysis menu.
You can also export the impulse response by using the Export option
under the File menu to export the impulse response to the Matlab
workspace in the variable
Num (by default).
In Matlab, you could plot the impulse response using the
(d) A word simply means the size of the data type
needed to store a value.
On the DSP board in lab, a word for a single-precision floating-point
float data type in C) is 32 bits or 4 bytes.