This shows you the differences between two versions of the page.
milestone_2_task_1 [2023/01/14 23:06] scott MATLAB |
milestone_2_task_1 [2023/01/18 15:18] (current) scott Figure scale |
||
---|---|---|---|
Line 25: | Line 25: | ||
* Player frequencies: 1471, 1724, 2000, 2273, 2632, 2941, 3333, 3571, 3846, 4167 (all in Hz) | * Player frequencies: 1471, 1724, 2000, 2273, 2632, 2941, 3333, 3571, 3846, 4167 (all in Hz) | ||
* Pulse length 200 ms (NOTE: A pulse length of 200 ms sampled at a frequency of 10 ksamples/s will yield a signal with 2000 total samples.) | * Pulse length 200 ms (NOTE: A pulse length of 200 ms sampled at a frequency of 10 ksamples/s will yield a signal with 2000 total samples.) | ||
- | |||
- | ==== Pass Off ==== | ||
- | **The following items need to be shown to the TAs (in person or over Zoom).** | ||
- | - Frequency response plot of the 10 filters overlaid in both linear and decibel scales {{ :m_2_1_1.jpg?100 |}} | ||
- | - Plots of total power of 200 ms long square wave through each filter (There should be 10 of these plots corresponding to a square wave for each of the player frequencies.) {{ :power.jpg?200 |}} | ||
- | - List of filter coefficients for the 10 bandpass filters | ||
====== Resources ====== | ====== Resources ====== | ||
Line 37: | Line 31: | ||
As you know, the laser tag system supports 10 players each with an assigned frequency in the range of 1.4 - 4.2 kHz. If the receiver is being illuminated or 'hit' by a laser tag gun then the sampled signal will consist of both a square wave at a particular frequency and noise. The system needs to analyze the received signal to determine whether the sampled signal contains a 'hit' by a laser tag gun. As the shooting gun gets farther away from the receiver, the amplitude of the square wave signal from the shooting gun gets smaller. Since the noise amplitude stays the same, this corresponds to a lower SNR, and it gets harder to distinguish the signal from the noise. This figure shows a square wave added to a random noise signal: | As you know, the laser tag system supports 10 players each with an assigned frequency in the range of 1.4 - 4.2 kHz. If the receiver is being illuminated or 'hit' by a laser tag gun then the sampled signal will consist of both a square wave at a particular frequency and noise. The system needs to analyze the received signal to determine whether the sampled signal contains a 'hit' by a laser tag gun. As the shooting gun gets farther away from the receiver, the amplitude of the square wave signal from the shooting gun gets smaller. Since the noise amplitude stays the same, this corresponds to a lower SNR, and it gets harder to distinguish the signal from the noise. This figure shows a square wave added to a random noise signal: | ||
- | {{ :square_example.jpg?200 |}} | + | {{ :square_example.jpg?600 |}} |
It will be easy for you to see the square wave in the close range signal, when the SNR is high. However, for longer-range signals, it will just look like noise even though there is a square wave embedded in the signal. The beauty of your signal processing system will be in its ability to detect a hit in the noisy received signal even at relatively large ranges. | It will be easy for you to see the square wave in the close range signal, when the SNR is high. However, for longer-range signals, it will just look like noise even though there is a square wave embedded in the signal. The beauty of your signal processing system will be in its ability to detect a hit in the noisy received signal even at relatively large ranges. | ||
Line 50: | Line 44: | ||
{{:lab5_fall2018.pdf|Lab #5 from ECEN 380}} | {{:lab5_fall2018.pdf|Lab #5 from ECEN 380}} | ||
- | {{::filter_design_notes.pdf|Supplementary filter design handout from Dr. Rice}} | + | {{::filter_design_notes.pdf|Supplementary filter design handout}} |
We are going to be using an Infinite Impulse Response (IIR) digital filter. Wikipedia has a description of this type of filter ([[http://en.wikipedia.org/wiki/Infinite_impulse_response]]). You should read through this description. The IIR digital filter is characterized by two sets of coefficients called a and b. | We are going to be using an Infinite Impulse Response (IIR) digital filter. Wikipedia has a description of this type of filter ([[http://en.wikipedia.org/wiki/Infinite_impulse_response]]). You should read through this description. The IIR digital filter is characterized by two sets of coefficients called a and b. | ||
Line 72: | Line 66: | ||
save a1.txt a1 -ascii -double | save a1.txt a1 -ascii -double | ||
</code> | </code> | ||
+ | |||
+ | In a future milestone, you will need to convert your MATLAB filter coefficients into C code for use on the ZYBO board. A script will be provided to ease this conversion. The script expects the following convention: | ||
+ | * The IIR a-coefficients must be stored in a 10 X 11 array named a_iir. (10 filters, 11 coefficients each) | ||
+ | * The IIR b-coefficients must be stored in a 10 X 11 array named b_iir. | ||
+ | |||
//Note: If we were making a true Coarse Frequency Domain calculation the filter would need to cover the entire band between the different player frequencies. However, in this system we have a discrete set of allowable frequencies. The filter just needs to pass one of these allowable frequencies to see if the receiver is 'hit'. Therefore, the bandwidth of the filter just needs to cover the specific allowable frequency that it is assigned. This means that the narrower the bandwidth the more noise that is rejected and the better the performance of the system. However, this assumes that the frequency of the transmitter does not change at all. Therefore, we need to create some bandwidth to allow wobble in the player frequency. How much bandwidth is actually needed would need to be determined experimentally. In this example we created a bandwidth of 50 Hz. This can be optimized after the system is built if you want to optimize the range of your system.// | //Note: If we were making a true Coarse Frequency Domain calculation the filter would need to cover the entire band between the different player frequencies. However, in this system we have a discrete set of allowable frequencies. The filter just needs to pass one of these allowable frequencies to see if the receiver is 'hit'. Therefore, the bandwidth of the filter just needs to cover the specific allowable frequency that it is assigned. This means that the narrower the bandwidth the more noise that is rejected and the better the performance of the system. However, this assumes that the frequency of the transmitter does not change at all. Therefore, we need to create some bandwidth to allow wobble in the player frequency. How much bandwidth is actually needed would need to be determined experimentally. In this example we created a bandwidth of 50 Hz. This can be optimized after the system is built if you want to optimize the range of your system.// | ||
Line 85: | Line 84: | ||
You should create a frequency domain plot for each of the bandpass filters and overlay them on the same plot. The result should look similar to the following. | You should create a frequency domain plot for each of the bandpass filters and overlay them on the same plot. The result should look similar to the following. | ||
- | {{ :m_2_1_1.jpg?100 |}} | + | {{ :m_2_1_1.jpg?600 |}} |
The horizontal axis should be in frequency and cover the entire allowable frequency band (0<f<5kHz). | The horizontal axis should be in frequency and cover the entire allowable frequency band (0<f<5kHz). | ||
Line 124: | Line 123: | ||
Plot the output of the filter command (operating on your square wave signal) for each of the 10 bandpass filters. The following plot shows the output of the first 4 bandpass filters when the square wave input has a frequency of 1471 Hz (the frequency for player 1): | Plot the output of the filter command (operating on your square wave signal) for each of the 10 bandpass filters. The following plot shows the output of the first 4 bandpass filters when the square wave input has a frequency of 1471 Hz (the frequency for player 1): | ||
- | {{ :filtered2.jpg?100 |}} | + | {{ :filtered2.jpg?600 |}} |
You can see from this plot that filters 2, 3, and 4 attenuate the signal a lot compared to filter 1 (look at the amplitudes of each filtered signal). The output of filter 1 has a much higher amplitude. If you zoom in on the output of filter 1 you should be able to see that the square wave was changed into a sine wave by the filter. (Do you understand why this happens? Remember that the square wave signal contains a sinusoid at the fundamental frequency, as well as higher frequency harmonics that give it a square shape. Our bandpass filter effectively takes out the higher harmonic frequencies that make it a square wave, leaving only the sinusoid at the fundamental frequency!) | You can see from this plot that filters 2, 3, and 4 attenuate the signal a lot compared to filter 1 (look at the amplitudes of each filtered signal). The output of filter 1 has a much higher amplitude. If you zoom in on the output of filter 1 you should be able to see that the square wave was changed into a sine wave by the filter. (Do you understand why this happens? Remember that the square wave signal contains a sinusoid at the fundamental frequency, as well as higher frequency harmonics that give it a square shape. Our bandpass filter effectively takes out the higher harmonic frequencies that make it a square wave, leaving only the sinusoid at the fundamental frequency!) | ||
Line 138: | Line 137: | ||
Your resulting bar graph produced using the square wave with the frequency for player 1 should look like this: | Your resulting bar graph produced using the square wave with the frequency for player 1 should look like this: | ||
- | {{ :power.jpg?200 |}} | + | {{ :power.jpg?600 |}} |
You should produce 10 of these plots, one for each of the 10 player frequencies. | You should produce 10 of these plots, one for each of the 10 player frequencies. | ||
Line 153: | Line 152: | ||
- Description of the pertinent features of the plots | - Description of the pertinent features of the plots | ||
- | ===== Milestone 2, Task 1 Pass Off ===== | + | ===== Pass Off ===== |
+ | The following items need to be shown to the TAs for pass off: | ||
+ | - Frequency response plot of the 10 filters overlaid in both linear and decibel scales {{ :m_2_1_1.jpg?600 |}} | ||
+ | - Plots of total power of 200 ms long square wave through each filter (There should be 10 of these plots corresponding to a square wave for each of the player frequencies.) {{ :power.jpg?600 |}} | ||
+ | - List of filter coefficients (with at least 17 significant digits) for each of the 10 bandpass filters | ||
- | The following plots need to be shown. | ||
- | - Frequency response plot of the 10 filters overlaid in both linear and decibel scales {{ :m_2_1_1.jpg?100 |}} | ||
- | - Plots of total energy of 200 ms long square wave through each filter (There should be 10 of these plots, one for each player frequency) {{ :m_2_1_2.jpg?100 |}} | ||
- | - List of filter coefficients for each of the 10 bandpass filters | ||