Hardware configuration
This configuration will require an additional piece of equipment, a second red pitaya. One red pitaya will be used as in the oscilloscope/signal generator or the spectrum analyzer modes, while the other will be used in the LTI DSP workbench. Connect the red pitayas such that the IN1 of the LTI DSP device is connected to OUT1 of the generator. You can also use a T-joint to connect the OUT1 of the generator board to IN1 of itself to see the response of the circuits more clearly and to measure the Frequency response with the Bode analyzer.
All-Pass Filter – Delay Element
Enter the following transfer function into the LTI workbench:
This is accomplished by setting =1. This kind of filter is called an all pass filter, due to its input/output relation of simply passing the output. Note that this is a special class of all-pass filter, namely a delay filter. This kind of filter purely provides a delayed version of the input as it’s output.
Measurement 1. Note down the Bode plot from the LTI workbench for both gain and phase(Note for some filters, you may want to do this over two screenshots, as the magnitude and phase are plotted on a common axis, even if one is in dB and the other is in degrees), and describe what happens as the frequency of the input signals are increased or decreased. (Hint: refer to the frequency response from the LTI workbench) Since this is an all-pass filter, the Bode plot should ideally show a flat magnitude response indicating a gain of 1 (or 0 dB) at all frequencies. The phase response would ideally be linear, indicating that each frequency component of the signal is delayed by the same amount. As you increase or decrease the frequency, the phase delay should correspondingly increase or decrease. 2. Show the resulting waveform in the Red Pitaya/Spectrum Analyzer scope object for 1. A sine wave of 1kHz is applied 2. A square wave of 1kHz is applied 3. A triangle wave of 1kHz is applied
Analysis
Is this also an all pass filter? Why or why not?
The function is indeed an all-pass filter. This filter introduces a delay of ‘k’ samples to the input signal but does not change the magnitude of any frequency component, hence qualifying as an all-pass filter.
- If I wanted to attenuate the incoming by 50% (multiply by 0.5) what would the general all-pass filter function be?
- Write out the difference equation for a general all pass filter.
To attenuate the incoming signal by 50%, the transfer function would be: . This introduces a delay while halving the magnitude of the input signal.
The difference equation for a general all-pass filter would be:
Moving average filter
An n-tap moving average filter has the form:
This is accomplished by setting . This kind of filter is called a moving average or boxcar filter, due to its nature of taking a local average of n samples at every sample point. Oftentimes the size of N is known as the window size.
4.6.3.3.1. Measurement 1. Note down the Bode plot from the LTI workbench for both gain and phase for the provided value of N, describing what happens as the frequency of the input signals are increased or decreased. 1. N=3 2. N=5 3. N=6 4. What are the trends as N gets larger? The Bode plot for a moving average filter will show that as the frequency of the input signal increases, the gain decreases. This is a characteristic of a low-pass filter. As N increases, the cut-off frequency of the filter decreases, and the filter becomes more selective. 2. Show the resulting waveform in the Red Pitaya/Spectrum Analyzer scope object for: 1. A sine wave of 1kHz is applied 2. A square wave of 1kHz is applied 3. A triangle wave of 1kHz is applied
Analysis
- What class of filter does this look like? (high-pass, low-pass, band-pass, band-stop)
- What does the window size say about the filter’s performance?
This filter is a low-pass filter.
The window size, N, determines the filter’s cut-off frequency and its selectivity. Larger N means lower cut-off frequency and higher selectivity.
- Write out the difference equation of this filter.
The difference equation of this filter is:
Low pass filter
Enter the following transfer function into the LTI workbench:
Measurement
- Note down the Bode plot from the LTI workbench for both gain and phase. (Note for some filters, you may want to do this over two screenshots, as the magnitude and phase are plotted on a common axis, even if one is in dB and the other is in degrees)
- Show the resulting waveform in the Red Pitaya/Spectrum Analyzer scope object for:
- A sine wave of 1kHz is applied
- A square wave of 1kHz is applied
- A triangle wave of 1kHz is applied
- Describe what happens as the frequency of the input signals are increased or decreased.
For a low-pass filter, as the frequency increases, the gain decreases. This effect is more prominent after the cut-off frequency.
Analysis
- Write out the difference equation of this filter.
- In the previous lab, we showcased that low-pass filters can be used to approximate integral operations. At what frequency does this filter do a passable job of implementing this operation?
This filter does a passable job of implementing integral operations at low frequencies, usually below its cut-off frequency.
1st difference filter
Enter the following transfer function into the LTI workbench:
This is accomplished by setting b0=0.5, b1=−0.5.
Measurement
- Note down the Bode plot from the LTI workbench for both gain and phase, and describe what happens as the frequency of the input signals are increased or decreased.
- Show the resulting waveform in the Red Pitaya/Spectrum Analyzer scope object for:
- A sine wave of 1kHz is applied
- A square wave of 1kHz is applied
- A triangle wave of 1kHz is applied
This filter should amplify the high frequencies while attenuating the low frequencies.
Analysis
- What does removing the common factor of 1/2 do to the filter? Why do you think the factor of 1/2 was included?
Removing the 1/2 factor would double the gain of the filter. The factor of 1/2 was included to normalize the filter response.
- Write out the difference equation of this filter.
- In the previous lab, we showcased that high-pass filters can be used to approximate derivative operations. At what frequency does this filter do a passable job of implementing this operation?
This filter does a passable job of implementing derivative operations at high frequencies.
Feedback
Enter the following transfer function into the LTI workbench:
Measurement 1. Note down the Bode plot from the LTI workbench for both gain and phase. (Note for some filters, you may want to do this over two screenshots, as the magnitude and phase are plotted on a common axis, even if one is in dB and the other is in degrees) 2. Show the resulting waveform in the Red Pitaya/Spectrum Analyzer scope object for 1. A sine wave of 1kHz is applied 2. A square wave of 1kHz is applied 3. A triangle wave of 1kHz is applied 3. Describe what happens as the frequency of the input signals are increased or decreased.The frequency response of this feedback filter would depend on the specific value of the feedback coefficient (0.93 in this case). The gain and phase response should be noted accordingly.
Analysis 1. Write out the difference equation of this filter.