Mechanical Engineering homework help
-
A606E96A-5CE3-4F55-92FA-C6B67370830C.png
Please watch the video and write a 3 page paper using a Quality Control point of view.
ECE505 Digital Signal Processing
Laboratory Project – Equalizer Design via the Windowing Method
1 Problem Description:
In this project we are going to design and construct a digital 5-channel equalizer for processing audio
files. Equalizers are used for adjusting the gain of an audio signal in different frequency bands.
2 Project Definition:
The equalizer design will have 5 bandpass filters in parallel, each multiplied by a gain constant (i.e.,
the band weight). The overall equalizer system can be drawn in block diagram form as follows:
So we have a parallel group of bandpass filters. The equivalent system transfer function can be written
as
H(z) = a1H1(z) + a2H2(z) + a3H3(z) + a4H4(z) + a5H5(z),
which leads to the total system impulse response,
h[n] = a1h1[n] + a2h2[n] + a3h3[n] + a4h4[n] + a5h5[n].
We are going to design each bandpass filter as an FIR using the windowing method. To begin, we
start with an ideal frequency response for a bandpass filter with lower and upper cutoff frequencies,
ωl and ωu, respectively, i.e.,
|H(e
jω)| =
(
1, if − ωu ≤ n ≤ −ωl
, ωl ≤ n ≤ ωu
0, otherwise.
We can then obtain the impulse response hi
[n] for this filter by applying the definition of the inverse
DTFT. The resulting impulse response will exist from (−∞, ∞) and we thus must window and shift
hi
[n] to make it a causal FIR filter for implementation. For each filter stage we have
hk[n] = hi
[n + (M − 1)/2]w[n + (M − 1)/2],
1
where k ∈ (1, 5) and w[n] is a windowing function of length M, with M odd. Once these filters are
combined to produce the overall impulse response h[n], we can process our audio file via convolution,
i.e.,
y[n] = x[n] ∗ h[n].
3 Design Tasks:
We will assume the input audio files are sampled at a rate of 44.1kHz, which is the rate used on audio
CDs. With our sampling rate fs = 44.1kHz (T = 1/44100 seconds), the effective continuous frequency
responses of the five filters should have a combined bandwidth ranging from 0 to 22.5kHz. I suggest
you divide the combined bandwidth up into five equal bands on a logarithmic scale. The reason for
such a selection is due to the logarithmic way in which humans perceive frequency.
I have provided a MATLAB function, bpw, that implements a causal FIR bandpass filter using the
windowing method. To use it, all you need to specify are the lower and upper digital cutoff frequencies
(in radians per sample), the length of the filter M, and the type of windowing function to apply (i.e.,
I’ve done the hard part). For additional help with the function open the .m file and read the help
section at the beginning of the file.
Your task is to design and create the 5 bandpass filters, which simply involves determining the cutoff
frequency for each filter and choosing a window type. For each filter use a length of M = 501. Also,
note that h1[n] and h5[n] will be lowpass and highpass filters, respectively. This is easily accounted
for by setting ωl = 0 for h1[n] and ωu = π for h5[n]. Once you have created each filter in MATLAB,
you simply need to multiply each filter by its respective gain factor (which are tuning parameters)
and sum the scaled impulse responses together. Then, apply the filter via convolution, i.e., using the
MATLAB command conv(x, h). Once processed, the reconstruction process is to be done using the
sound() command in MATLAB so that you can listen to the results of applying your filter.
To design your equalizer perform the following design tasks. Include any results generated in this
section in the Design section of the document your submit for this project.
1. Use the inverse DTFT to derive the impulse response hi
[n] for an ideal bandpass filter with
lower cutoff ωl and upper cutoff ωh.
2. Determine the upper and lower analog cutoff frequencies for each bandpass filter in radians per
second. I suggest using a logarithmic scale and dividing the frequency axis into five nearly equal
segments from the range of 22.5Hz to 22.05kHz. Once you determine these analog frequencies,
map each one to their corresponding digital frequency in radians per sample.
3. Create the five filters in MATLAB using the bpw function with the digital frequencies you
determined above. Create h3[n] using a rectangular window. Then generate h3[n] again using
a Blackman window. For the other four filters select windows of your choosing. Create the five
gain factors as configurable parameters. Now, multiply each impulse response by its respective
filter gain and sum them all together to obtain the total impulse response.
4. Let’s also generate 10th order IIR bandpass filters using ωl and ωu from h3[n] based upon
Butterworth, Chebychev, and Elliptic filters. Create each filter using these commands:
[b1, a1] = butter(5, [wl/pi wu/pi])
[b2, a2] = cheby1(5, 1, [wl/pi wu/pi])
2
[b3, a3] = ellip(5, 1, 80, [wl/pi wu/pi])
In each case, notice that the digital cutoff frequencies are normalized by π. The reason for this is
because MATLAB expects the [0, π] range to be normalized to the [0, 1] range. These functions
return the numerator transfer function coefficients in b and the denominator transfer function
coefficients in a that can then be used to generate the frequency response and corresponding
difference equation.
5. Now, read in an audio file using the audioread command (there are several music clips on the
class website that have been sampled at 44.1kHz). Convolve the audio file with the total impulse
response. Listen to the result using the sound command. Now, tune the gain parameters until
you find a set of values that you like.
4 Questions:
Prepare a document for online submission that includes all requested figures, information, and answers
to the questions below.
1. Show the results of your analytic derivation for the impulse response of the ideal bandpass filter.
Can you infer any meaning from this result?
2. Explain how you determined the analog filter cutoff frequencies and create a table in your
document that contains your designed analog cutoff frequencies in radians per second:
Filter ωl (radians/second) ωh (radians/second)
h1[n]
h2[n]
h3[n]
h4[n]
h5[n]
3. Explain how you obtained the digital cutoff frequencies and create a table in your document
that contains the digital cutoff frequencies in radians per sample corresponding to the analog
cutoff frequencies specified above in the following format:
Filter ωl (radians/sample) ωh (radians/sample)
h1[n]
h2[n]
h3[n]
h4[n]
h5[n]
4. Plot the middle bandpass filter impulse response, h3[n], using both the rectangular and Blackman
windows. Use the stem command and plot them on two separate subplots. Include this plot as
Figure 1. Discuss the differences you observe when comparing the impulse responses.
3
5. Next, plot the magnitude of the frequency response |H3(e
jω)| for the middle bandpass filter using
the rectangular and Blackman windows on the same plot. Use N = 4096 points in the fft. Also,
generate the magnitude frequency response for an ideal bandpass filter (i.e., a rect function) at
the corresponding digital cutoff frequencies and plot it on the same plot for comparison. I would
also suggest you zoom your plot to best see the details of the filters using the axis command,
e.g., axis([−.5 .5 0 1.2]) or whatever range best displays your filters. Use digital frequency
(radians/sample) for the frequency scale, i.e., [−π, π]. Include this plot as Figure 2. Compare
the plots. Discuss the differences you observe between the two filters and explain how they each
compare to the ideal bandpass filter.
6. Next, use the transfer function coefficients to generate the magnitude frequency response for
each 10th order IIR filter and plot them on the same plot, similar the Figure 2. Again, plot
the magnitude response for the ideal bandpass filter at the given cutoff frequencies on the same
plot for comparison. Use digital frequency (radians/sample) for the frequency scale, i.e., [−π, π].
Include this plot as Figure 3. Compare the plots. Discuss the differences you observe between
the three filters and explain how they each compare to the ideal bandpass filter. How do these
filters compare with the FIR counterparts? Comment on the performance in regards to the order
of the FIR versus IIR filters.
7. Create a table in your document similar to that below that specifies the filter gain factors you
selected for your equalizer and explain why you chose those values for modifying the sound clip.
Also, provide the values in dB (i.e., ˆak = 20 log10(ak) dB).
Filter Gain (V/V) Gain (dB)
h1[n]
h2[n]
h3[n]
h4[n]
h5[n]
8. Using these gain values, plot the magnitude frequency response for each individual filter, i.e.,
|Hk(e
jω)| for k = 1, 2, . . . , 5 (again use N = 4096 points in the fft). You should plot all five
filter responses on the same plot. Plot these as a function of Hertz rather than digital frequency
(f = fs
ω
2π
) and use a logarithmic scale for the x-axis. To do this, instead of using the plot
command, use the semilogx command. Include this plot as Figure 4. Explain the characteristics
you observe with each individual filter. Does each filter passband appear to be nearly the same
width on a logarithmic scale per our design guidelines? Explain.
9. Now, repeat the previous step for the total system magnitude frequency response |H(e
jω)| and
include this result as Figure 5. Discuss the plot as compared with the individual frequency
responses.
10. Plot 2000 samples of the input and output audio sequence, x[n] and y[n], on the same plot.
Include this plot as Figure 6. Explain any differences that you observe and relate it to the shape
of the total frequency response and the gains you selected.
11. Plot the frequency spectrum of the input and output audio signals, X(e
jω) and Y (e
jω), on two
separate subplots again using a logarithmic frequency scale (Hertz) for the x-axis. In this case,
do not specify N for the fft so that it will set N equal to the length of the sequence. Include
these plots as Figure 7. Based upon your chosen band gains, does the output signal indicate
that these gains have been properly applied? Explain.
5
ECE505 Digital Signal Processing
Laboratory Project – Equalizer Design via the Windowing Method
1 Problem Description:
In this project we are going to design and construct a digital 5-channel equalizer for processing audio
files. Equalizers are used for adjusting the gain of an audio signal in different frequency bands.
2 Project Definition:
The equalizer design will have 5 bandpass filters in parallel, each multiplied by a gain constant (i.e.,
the band weight). The overall equalizer system can be drawn in block diagram form as follows:
So we have a parallel group of bandpass filters. The equivalent system transfer function can be written
as
H(z) = a1H1(z) + a2H2(z) + a3H3(z) + a4H4(z) + a5H5(z),
which leads to the total system impulse response,
h[n] = a1h1[n] + a2h2[n] + a3h3[n] + a4h4[n] + a5h5[n].
We are going to design each bandpass filter as an FIR using the windowing method. To begin, we
start with an ideal frequency response for a bandpass filter with lower and upper cutoff frequencies,
ωl and ωu, respectively, i.e.,
|H(e
jω)| =
(
1, if − ωu ≤ n ≤ −ωl
, ωl ≤ n ≤ ωu
0, otherwise.
We can then obtain the impulse response hi
[n] for this filter by applying the definition of the inverse
DTFT. The resulting impulse response will exist from (−∞, ∞) and we thus must window and shift
hi
[n] to make it a causal FIR filter for implementation. For each filter stage we have
hk[n] = hi
[n + (M − 1)/2]w[n + (M − 1)/2],
1
where k ∈ (1, 5) and w[n] is a windowing function of length M, with M odd. Once these filters are
combined to produce the overall impulse response h[n], we can process our audio file via convolution,
i.e.,
y[n] = x[n] ∗ h[n].
3 Design Tasks:
We will assume the input audio files are sampled at a rate of 44.1kHz, which is the rate used on audio
CDs. With our sampling rate fs = 44.1kHz (T = 1/44100 seconds), the effective continuous frequency
responses of the five filters should have a combined bandwidth ranging from 0 to 22.5kHz. I suggest
you divide the combined bandwidth up into five equal bands on a logarithmic scale. The reason for
such a selection is due to the logarithmic way in which humans perceive frequency.
I have provided a MATLAB function, bpw, that implements a causal FIR bandpass filter using the
windowing method. To use it, all you need to specify are the lower and upper digital cutoff frequencies
(in radians per sample), the length of the filter M, and the type of windowing function to apply (i.e.,
I’ve done the hard part). For additional help with the function open the .m file and read the help
section at the beginning of the file.
Your task is to design and create the 5 bandpass filters, which simply involves determining the cutoff
frequency for each filter and choosing a window type. For each filter use a length of M = 501. Also,
note that h1[n] and h5[n] will be lowpass and highpass filters, respectively. This is easily accounted
for by setting ωl = 0 for h1[n] and ωu = π for h5[n]. Once you have created each filter in MATLAB,
you simply need to multiply each filter by its respective gain factor (which are tuning parameters)
and sum the scaled impulse responses together. Then, apply the filter via convolution, i.e., using the
MATLAB command conv(x, h). Once processed, the reconstruction process is to be done using the
sound() command in MATLAB so that you can listen to the results of applying your filter.
To design your equalizer perform the following design tasks. Include any results generated in this
section in the Design section of the document your submit for this project.
1. Use the inverse DTFT to derive the impulse response hi
[n] for an ideal bandpass filter with
lower cutoff ωl and upper cutoff ωh.
2. Determine the upper and lower analog cutoff frequencies for each bandpass filter in radians per
second. I suggest using a logarithmic scale and dividing the frequency axis into five nearly equal
segments from the range of 22.5Hz to 22.05kHz. Once you determine these analog frequencies,
map each one to their corresponding digital frequency in radians per sample.
3. Create the five filters in MATLAB using the bpw function with the digital frequencies you
determined above. Create h3[n] using a rectangular window. Then generate h3[n] again using
a Blackman window. For the other four filters select windows of your choosing. Create the five
gain factors as configurable parameters. Now, multiply each impulse response by its respective
filter gain and sum them all together to obtain the total impulse response.
4. Let’s also generate 10th order IIR bandpass filters using ωl and ωu from h3[n] based upon
Butterworth, Chebychev, and Elliptic filters. Create each filter using these commands:
[b1, a1] = butter(5, [wl/pi wu/pi])
[b2, a2] = cheby1(5, 1, [wl/pi wu/pi])
2
[b3, a3] = ellip(5, 1, 80, [wl/pi wu/pi])
In each case, notice that the digital cutoff frequencies are normalized by π. The reason for this is
because MATLAB expects the [0, π] range to be normalized to the [0, 1] range. These functions
return the numerator transfer function coefficients in b and the denominator transfer function
coefficients in a that can then be used to generate the frequency response and corresponding
difference equation.
5. Now, read in an audio file using the audioread command (there are several music clips on the
class website that have been sampled at 44.1kHz). Convolve the audio file with the total impulse
response. Listen to the result using the sound command. Now, tune the gain parameters until
you find a set of values that you like.
4 Questions:
Prepare a document for online submission that includes all requested figures, information, and answers
to the questions below.
1. Show the results of your analytic derivation for the impulse response of the ideal bandpass filter.
Can you infer any meaning from this result?
2. Explain how you determined the analog filter cutoff frequencies and create a table in your
document that contains your designed analog cutoff frequencies in radians per second:
Filter ωl (radians/second) ωh (radians/second)
h1[n]
h2[n]
h3[n]
h4[n]
h5[n]
3. Explain how you obtained the digital cutoff frequencies and create a table in your document
that contains the digital cutoff frequencies in radians per sample corresponding to the analog
cutoff frequencies specified above in the following format:
Filter ωl (radians/sample) ωh (radians/sample)
h1[n]
h2[n]
h3[n]
h4[n]
h5[n]
4. Plot the middle bandpass filter impulse response, h3[n], using both the rectangular and Blackman
windows. Use the stem command and plot them on two separate subplots. Include this plot as
Figure 1. Discuss the differences you observe when comparing the impulse responses.
3
5. Next, plot the magnitude of the frequency response |H3(e
jω)| for the middle bandpass filter using
the rectangular and Blackman windows on the same plot. Use N = 4096 points in the fft. Also,
generate the magnitude frequency response for an ideal bandpass filter (i.e., a rect function) at
the corresponding digital cutoff frequencies and plot it on the same plot for comparison. I would
also suggest you zoom your plot to best see the details of the filters using the axis command,
e.g., axis([−.5 .5 0 1.2]) or whatever range best displays your filters. Use digital frequency
(radians/sample) for the frequency scale, i.e., [−π, π]. Include this plot as Figure 2. Compare
the plots. Discuss the differences you observe between the two filters and explain how they each
compare to the ideal bandpass filter.
6. Next, use the transfer function coefficients to generate the magnitude frequency response for
each 10th order IIR filter and plot them on the same plot, similar the Figure 2. Again, plot
the magnitude response for the ideal bandpass filter at the given cutoff frequencies on the same
plot for comparison. Use digital frequency (radians/sample) for the frequency scale, i.e., [−π, π].
Include this plot as Figure 3. Compare the plots. Discuss the differences you observe between
the three filters and explain how they each compare to the ideal bandpass filter. How do these
filters compare with the FIR counterparts? Comment on the performance in regards to the order
of the FIR versus IIR filters.
7. Create a table in your document similar to that below that specifies the filter gain factors you
selected for your equalizer and explain why you chose those values for modifying the sound clip.
Also, provide the values in dB (i.e., ˆak = 20 log10(ak) dB).
Filter Gain (V/V) Gain (dB)
h1[n]
h2[n]
h3[n]
h4[n]
h5[n]
8. Using these gain values, plot the magnitude frequency response for each individual filter, i.e.,
|Hk(e
jω)| for k = 1, 2, . . . , 5 (again use N = 4096 points in the fft). You should plot all five
filter responses on the same plot. Plot these as a function of Hertz rather than digital frequency
(f = fs
ω
2π
) and use a logarithmic scale for the x-axis. To do this, instead of using the plot
command, use the semilogx command. Include this plot as Figure 4. Explain the characteristics
you observe with each individual filter. Does each filter passband appear to be nearly the same
width on a logarithmic scale per our design guidelines? Explain.
9. Now, repeat the previous step for the total system magnitude frequency response |H(e
jω)| and
include this result as Figure 5. Discuss the plot as compared with the individual frequency
responses.
10. Plot 2000 samples of the input and output audio sequence, x[n] and y[n], on the same plot.
Include this plot as Figure 6. Explain any differences that you observe and relate it to the shape
of the total frequency response and the gains you selected.
11. Plot the frequency spectrum of the input and output audio signals, X(e
jω) and Y (e
jω), on two
separate subplots again using a logarithmic frequency scale (Hertz) for the x-axis. In this case,
do not specify N for the fft so that it will set N equal to the length of the sequence. Include
these plots as Figure 7. Based upon your chosen band gains, does the output signal indicate
that these gains have been properly applied? Explain.
5
For any questions, feedback, or comments, we have an ethical customer support team that is always waiting on the line for your inquiries.
Talk to us support@bestqualitywriters.com