Вы находитесь на странице: 1из 5

ECE 3512 Spring 2011 (Assignment #3)

The Analysis of High Pass Filters and Convolution


Nabidur Rahman & Asish Mathew
AbstractA high-pass filter is a filter that passes high frequency signals but reduces the amplitude of signals lower than the specified cutoff frequency. This concept is similar to that of an active RC circuit, whose arrangement has the capacitor first and the circuit last, where its design implementation makes high frequency components pass and low frequency components reduced. Using the principles of high pass filters, we are to analyze the systems output when several signals are passed through the filter. Using the principles of convolution, we can create a delay in one channel of an audio clip to produce a resulting surround sound effect.

impedance values, the transfer function is simplified to the following: H = = 1 + 1 Using the filters transfer function, we can derive the magnitude and phase equations and further validate if the characteristics resemble that of a high pass filter. The magnitude and phase equations of a generic High Pass Filter can be denoted as: |H| = = 2 + 1 + 1 H = tan 3 2 When the value of is really small, |H()| = RC and the phase is 90. When the value of approaches infinity, |H(| = 1 and the phase is 0. These resulting values resemble the characteristics of a high pass filter. Our objective for Part 1 is to design a high pass filter and determine the output of several signals when they are passed through the filter. Using an audio sample, we are to observe the sound we hear and the resulting Fourier Transform before and after we pass it through our high pass filter and discuss the different variations as the cutoff frequency of the filter is changed. Part 2 of the experiment asks us to create a basic surround sound effect using the methods of convolution. To create such an effect, we will have to convolve one of the channels to initiate a time delay in the audio signal. A delayed impulse creates a copy of the inputted signal at a time delay specified by the user. Using MATLAB, we can demonstrate a surround sound effect and the effects convolution has on any signal.

I. INTRODUCTION

HE objective of this assignment is to understand the concept of a high pass filter and to gain experience with convolution in a practical setting. In order to fully understand the concept of a high pass filter, we must first understand what an RC Circuit is and how it is reflected as both a low and high pass filter, depending on the design of the circuit. A circuit that consists of a resistor and capacitor in series connections can be seen as a filter. A High Pass Filter resembles the following circuit design:

Figure 1 Generic High Pass Filter From the circuit diagram shown above, we can observe that the capacitor is an open-circuit at low frequencies, which means that the output y(t) will just short to ground. Conversely, the capacitor will short out at high frequencies which results in y(t) equaling the input x(t). Using these principles, we can validate that the circuit architecture shown in Figure 1 is that of a high pass filter. To further understand the intuition of a high pass filter, we can analyze the filters transfer function and its respective magnitude and phase equations. We know that filters are Linear Time Invariant Systems (LTIV), and that a transfer function is simply denoting the ratio of the output from the input. Since filters are analyzed in the frequency domain, we can use Figure 1 and solve for the transfer function of a high pass filter. Using

II. PROCEDURE AND RESULTS (PART 1) The first part of the assignment is to design a high pass filter by selecting a cutoff frequency between 100Hz < 10,000 Hz. Using that specific cutoff frequency, we were to determine the value of RC and of our high pass filter. We chose our cutoff frequency as 2000Hz. Since = and RC =

, our cutoff frequency, , is determined to be

1.26 x rad/sec (Complete calculation can be found in the

ECE 3512 Spring 2011 (Assignment #3) Appendix of this report). Using these values, we are to plot the transfer function of our high pass filter using the bode command in MATLAB. The Bode Plot of our filter is shown below:
Bode Diagram of High Pass Filter 0 -10 Magnitude (dB) -20 -30
Amplitude 2 1 0 -1 -2 0 1 2 Time (sec) Step Response 1 3 4

2 As we stated earlier in the Introduction, the circuit design and the location of the resistor and capacitor determine what type of filter is being produced. Since a High Pass filter models the circuit design as shown in Figure 1, the resulting step response should resemble that of a capacitor discharging. The resulting step and impulse plots are shown below for a low pass and high pass filter with the same cutoff frequency at 2000 Hz:
x 10
4

Impulse Response HPF LPF

-40 -50 90

Phase (deg)

5 x 10
-4

45

0
Amplitude

0.8
2

HPF LPF

10

10

10

10

10

0.6 0.4 0.2 0 0 1 2 Time (sec) 3 4

Frequency (rad/sec)

Figure 2 Bode Diagram of our High Pass Filter with = 1.26 10 rad/sec From Figure 2, we can see that the bode plot takes on the characteristics of a high pass filter. We can recall that a high pass filter rejects low frequencies and retains high frequencies. From the Magnitude plot, we can observe this exact procedure happening. We can also verify if our bode plot is correct if we recall that every filters cutoff frequency happens at the -3dB point. That means that our value of should be at the -3dB point in our bode diagram. Using Equation 2 and our value of , our answer should result in 0.707, which can then be converted into its respective value of -3dB. The phase plot should also show 45 at our value of . Using equation 3, we get a result of 45, which is exactly what we expect. (Calculations of the magnitude and phase can be found in the Appendix, along with a Bode Diagram with Data Acquisition units to further verify if our bode diagram is correct). Another way to confirm if our bode diagram is correct is to plot the step and impulse response of our high pass filter. We recall that from a low pass filter, the step response should resemble that of a capacitor charging due to the circuit diagram shown below of a Low Pass Filter:

5 x 10
-4

Figure 4 Impulse and Step Responses of both a High and Low Pass Filter at = 2000Hz. Red denoting High Pass Filter (HPF) and Green denoting Low Pass Filter (LPF) We can observe from Figure 4 that the resulting impulse and step response for our high pass filter are correct. As we expected, the step response resembles a capacitor discharging as opposed to an RC low pass filter circuit whose step response resembles that of a capacitor charging. For the impulse response of our High Pass filter, we can observe that it is approaching 0, which makes sense due to the behavior of a High Pass filter. An impulse response is the circuits output when the input is an instantaneous impulse, described as x(t) = t. If we recall the behavior of a High Pass filter, it reduces the amplitudes of low frequencies and retains high frequencies below the specified cutoff frequency. Since an impulse response tests the circuit at all frequency values, its resulting plot should resemble that of the magnitude plot of an ideal high pass filter. Upon observing Figure 4, we see this exact procedure happening. Although we were not required to show the impulse and step response of our High Pass filter, it is important to understand what a step or impulse response is and the fact that they can further verify if we properly designed a high pass filter or not. From Figures 2 and 4, we know that we have successfully designed a High Pass Filter, where it can now be implemented for Part B of the assignment.

Figure 3 - order Low Pass Filter

ECE 3512 Spring 2011 (Assignment #3) PART B Part B of Section 1 is now asking us to use the high pass filter we designed in Part A and observe the resulting output when several signals are inputted into the filter. MATLAB has a function called lsim which is essentially the High Pass Filter. The function lsim simulates the time response of continuous or discrete linear systems to arbitrary inputs. Since the transfer function of our filter is already defined in MATLAB as Equation 1, the lsim function shows the results as signals pass through the transfer function. We decided to pass through three different signals: one cosine wave, one sawtooth wave, and one square wave. Results for this procedure are shown below:
x(t)=2cos(5t) 2 0 -2 0 0.5 1 1.5 2.5 3 Time (sec) x(t)=Sawtooth(50t) 2 3.5 4 4.5 x(t) y(t)
-1.5 -1

3 resemble a slope of 0 and almost no signal components the original square wave had. After changing the time vector of the square signal to a more specific region, we zoomed in to observe what was actually happening at 0.125 seconds. The zoomed in figure is shown below:
Zoomed in View of our Sawtooth Signal 1 input output

0.5

0 x(t)

-0.5

x(t)

5
-2 0.124 0.1245 0.125 0.1255 Time (sec) 0.126 0.1265 0.127

2 x(t) 0 -2 0 0.1 0.2 0.3 0.4 0.5 0.6 Time (sec) x(t)=Square(700t) 0.7 0.8 0.9 1

Figure 6 Zoomed in view of our square wave with frequency at 50 rad/sec to further aid an explanation if this result is expected or not From Figure 6, we can observe that the resulting output follows the intuition we had stated earlier about capacitors discharging and charging over time. We know that from Figure 1, the orientation of our circuit shows the capacitor first and the resistor last, all in series formation. If the RC time constant is short compared to the time period of the input, the capacitor will become fully charged quickly before the next change in the cycle. We also know that when the capacitor is fully charged, the output of the resistor is going to be 0. Using this intuition, we can see this exact procedure taking place in Figure 7. The capacitor quickly discharges and then recharges as the sawtooth signal changed amplitude. We can use this exact analysis to explain the filtered square wave. In this case, the arrival of the falling edge of the input waveform causes the capacitor to reverse charge, giving a negative spike output. As the square wave input changes during each cycle, the output spike changes from a positive value to a negative value. This procedure fits exactly with our resulting output of our square wave. Taking all these observations into account, we can observe that our High Pass filter successfully filtered out each input to its expected output. This is an important part of the assignment because it continues to validate that our High Pass filter is designed correctly and that the resulting outputs match what we should expect from a High Pass Filter. Using the same High Pass Filter designed in Part A, our next objective is to pass an audio clip through the filter and observe the output and the resulting sound.

1 0 -1 0

x(t) y(t) 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 Time (sec) 0.02

x(t)

Figure 5 Three different signals inputted into our High Pass Filter with the resulting output. Title describes what our input signal is and the filtered signal in either green or red (see legend for each plot)

From Figure 5, we can see that our High Pass filter successfully filtered out each signal to what we should expect. Our first plot shows a cosine input at 5 rad/sec with an amplitude of 2. Recalling the behavior of a High Pass filter, the resulting signal should be suppressed to 0 since the filter design eliminated all the low frequency components of the cosine wave. The second signal we decided to input was a sawtooth wave at 50 rad/sec. We can observe that the output is interesting to analyze since the sawtooth is suppressed to the output that of our first plot. However, our third output plot offers an even more interesting output behavior, similar to that of a capacitor charging and discharging. To help answer this question and to assure ourselves that the filter is producing the right outputs, we decided to zoom in on our third plot between 0.1 and 0.2 seconds and observe what was actually happening. Since the time vector shown has too many frequencies, the resulting figure is compressed to

ECE 3512 Spring 2011 (Assignment #3) PART C Part C of Section 1 instructs us to import a short audio clip that was used in the previous Homework assignment and use the same procedure as Part B to High Pass filter our audio clip. We use the lsim command in MATLAB to simulate the LTIV filter to arbitrary inputs. In this case, the input is our 3 second audio clip. Using the same cutoff frequency at 2000Hz, we High Pass filtered our audio clip and noticed a change in the sound. At a cutoff of 2000Hz, the High Pass filtered audio sounded very high in pitch, losing all the bass components the original sound clip had. This makes perfect sense because a High Pass Filter is designed to reject low frequencies and retain high frequencies. In Homework Assignment 2, we discussed that treble sounds (High Pitch) carry high amount of energies at low frequencies. Bass tones had high energies at low frequencies. Since the High Pass filter reduced the low frequencies, the bass element of the sound was completely removed. Using 2000Hz as our initial cutoff frequency, we decided to vary the filter cutoff to different values. A table below describes the resulting effect we observed at those specific cutoffs:

4 function in MATLAB as we did in Homework Assignment 2 to plot the Fourier Transform and comment on the resulting output. Using our initial cutoff frequency at 2000 Hz, the Original vs. Filtered transform is shown below:
Original Vocal/Midrange Tone 0.01

|F(w)|

0.005

500

1000

1500 2000 2500 3000 frequency (Hz) HPF of Vocal/Midrange Tone

3500

4000

0.01

|F(w)|

0.005

500

1000

1500 2000 2500 frequency (Hz)

3000

3500

4000

Figure 7 Fourier Transform of original sound clip and Fourier transform of High Pass filtered sound clip at = 2000 Hz We can observe from Figure 7 that the Resulting Fourier Transform has almost no energies remaining. Taking into account that the cutoff frequency was 2000Hz, low frequency values before the cutoff were rejected. This makes perfect intuitive sense of a High Pass Filter. Conversely, we decided to assign a new cutoff at 200Hz instead of 2000 Hz to observe if our intuition would hold on a lower cutoff frequency. The resulting plot is shown on the following page:
Original Vocal/Midrange Tone 0.01

Cutoff Frequency

Result/Observation In comparison to 2000Hz, we observed that there was still some bass elements remaining in the audio clip. Pitch was definitely increased. At 3000Hz, we observed that there were almost no bass tones and that the voice of the artist had significantly increased in distortion. At 6000Hz, all the bass tones were eliminated. The distortion level increased as we expected and the voice was undistinguishable as the original sound clip. Similar observation as 6000 Hz, not much significant change

= 500

= 3000

|F(w)|

0.005

= 6000

500

1000

1500 2000 2500 3000 frequency (Hz) HPF of Vocal/Midrange Tone

3500

4000

0.01

|F(w)|

= 9000

0.005

Table 1 - Description of Sound Observed at Different Frequency Cutoffs

500

1000

1500 2000 2500 frequency (Hz)

3000

3500

4000

After the different observations were described for each cutoff frequency, our final objective was to plot the Fourier Transform of the original sound clip vs. the Fourier Transform of our High Pass filtered sound clip. We can use the myFFT

Figure 8 Fourier Transform of Original Sound Clip vs. the Fourier Transform of High Pass Filtered Sound Clip at = 200 Hz

ECE 3512 Spring 2011 (Assignment #3) We can observe from Figure 8 that at a lower cutoff frequency, the High Pass filter retains more energy at low to midrange frequencies than opposed to a higher cutoff frequency. Since we discussed the behavior of our High Pass filter, these answers are within expectable range and we now fully understand the methodology behind a High Pass Filter. The higher the cutoff, the more low frequency components get reduced, with a resulting sound of high distortion and less clarity with higher pitch.

5 with an impulse is simply copying x(t) and re-centering it on the impulse response. We discovered this concept in Homework Assignment 1, where multiplying in the time domain equals the convolution in the frequency domain. The same theory can be applied backwards; that is, convolving in the time domain equals the multiplication of the frequency domain. Using these concepts, convolving any signal with the impulse response of a High Pass Filter would produce the same output as simulating the LTIV system we designed in Part 1 of this assignment. In Part D of Part 1, we decided to do some research as to how filters are implemented in stereo networks. The following diagram shows the implementation of both a low and high pass filter:

III. PROCEDURE AND RESULTS (PART 2) Part 2 of the assignment requires us to create a basic surround sound effect. A simple surround sound effect can be created if we were to follow the diagram shown below:

Figure 9 Diagram of a Stereo Sound Output with a Delay To effectively create a copy of our signal at a delay of time T, we need to state that = . Furthermore, we can use this equation to relate our output as follows: = = 4 Our sampling rate, , is 44.1 E3, and our assigned dt will be 1/ . We create a time channel delay in MATLAB to create the array which will consist of a string of zeroes followed by the impulse. The code to perform the specified method was given to us to implement for our own audio clip, so the results will vary for different effects of the sound. Our initial observation is that 10ms displays the shortest delay and 1000ms displays the longest delay. We observed that the audio clip we imported into MATLAB is now repeating the song twice. This makes intuitive sense because convolution is essentially copying the signal and then re-centering it at the impulse. At 10ms, we observed that there is also an instantaneous delay and the effects of convolving the left channel cannot be sensed. As the song reaches its maximum time constraint, we notice the sound to be very annoying, notably around 850ms. We find the best sounding time delay to be around 500ms. IV. INTERESTING FINDINGS We also observed that convolution shares a relationship with filters. We discovered that if we convolved our three x(t) in Figure 5 with the impulse response of a high pass filter, we could produce the same results as MATLAB did with the lsim command. In lecture, we discussed that convolution Figure 10 Stereo Network Implemented with Low and High Pass Filter We can observe that as the Stereo outputs the sound, it travels through the Woofer, Midrange, and Tweeter. It shows that the sound is low pass filtered as it reaches the Woofer and High Pass Filters the sound at the Tweeter. This makes logical sense because Tweeters produce pitch and treble tones and Woofers create bass tones. This shows filtering in a practical setting in audio networks, with convolution to create a delay in one channel of sound to result in a surround sound effect.

V. DISCUSSION After completing the assignment, we learned the concept of a High Pass Filter and how it rejects low frequencies and retains high frequencies below the specified cutoff. We also observed how the circuit designed reflects the design of either a low or high pass filter. From all the observations from Parts 1 and 2 of this Assignment, we can see how a High Pass Filter change the audio effects of music and how convolution can be used to create a time delay that creates a surround sound effect. This assignment further enhances our knowledge on filtering and its contributing help in audio signal processing, as well as using convolution in a practical setting. We hope to use the methods of filtering in future homework assignments.

Вам также может понравиться