Difference between revisions of "EGR 224/Active Filter"

From PrattWiki
Jump to navigation Jump to search
 
(Requirements)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
The following page provides some supplemental information for the '''Active Filters ''' lab for [[EGR 119|EGR 119L]].  It has been updated to Spring, 2009.
+
The following page provides some supplemental information for the '''Active Filters ''' lab for [[EGR 224|EGR 224L]].  It has been updated to Spring, 2020.
 +
== Requirements ==
 +
You will need access to MATLAB with the Signal Processing Toolbox.  You can use MATLAB on the Duke system if you connect via VPN; see [[How To Get Work Done]] for more on that.  Then use a terminal program to connect to Duke.  Run the command
 +
xeyes &
 +
to make sure graphics are working.  Note that you will not be able to use MATLAB to play the audio this way, but I have uploaded WAV versions of the files so you can still hear the sounds.
  
== Wiring Images ==
+
You can also use a Virtual Computer from Duke if you do not want to install MATLAB on your own machine.  The [[VCL]] page has more information on that.  One advantage of this is that you can play the audio through MATLAB.
 +
 
 +
Finally, you can install [[MATLAB]] on your own computer.  If you installed MATLAB on your own computer but do not have the Signal Processing Toolbox:
 +
* Go to the HOME tab
 +
* Find and click on "Add-Ons"
 +
* Search for Signal Processing
 +
* Click on the link for the Signal Processing Toolbox
 +
* Sign in to install if need be
 +
* Install
 +
 
 +
== Script from 7.4.2 ==
 +
<source lang=matlab>
 +
clear
 +
load DukeFightSong
 +
%% Filter constants
 +
R = 10000;  C = 50e-9;
 +
 
 +
%% Experimental Transfer Function
 +
[EstH, EstF] = tfestimate(SoundIn, SoundOut, [], [], [], samplerate);
 +
EstMag = abs(EstH);
 +
EstOmega = EstF*2*pi;
 +
%% Analytical Transfer Function
 +
s = tf([1 0], [1]);
 +
H = 1 / (1 + s * R * C);
 +
[HMag, HPhase, HOmega] = bode(H, {1, max(EstOmega)});
 +
HMag = squeeze(HMag);
 +
%% Make plot
 +
figure(1); clf
 +
semilogx(EstOmega, 20*log10(EstMag), 'b-')
 +
hold on
 +
semilogx(HOmega, 20*log10(HMag), 'r-')
 +
hold off
 +
xlabel('\omega, rad/s'); ylabel('|H|, dB')
 +
legend('Estimates', 'Theoretical', 'location', 'best')
 +
</source>
 +
<!--
 +
== Points of Clarification ==
 +
* 8.4.2 - be sure to complete the wiring in Tables 5.1-5.4 '''''EXCEPT''''' for the wires that go into DAC0OUT, DAC1OUT, and AOGND.  Repeat - do NOT install the red wires for DAC0OUT, DAC1OUT, or AOGND.  If you are using more than one red wire, you have done something wrong!  Installing these wires will short out your audio source and you will not be able to get sufficient volume.
 +
* In all cases, make sure the breadboard is turned on and the voltages are turned fully on '''''before''''' taking your data.  The danger here is that the original sound '''c1''' will sound OK even if the power is off since it does not pass through any op-amps.  The important data - '''c4''' - will be wrong, however, unless the op-amps are powered.
 +
 
 +
== Images ==
 +
=== Wiring ===
 
[[Image:TwoBufferAndCopies.jpg|thumb|Closeup of the LM 342 with buffer wiring and OpAmp 1 copy wiring]]
 
[[Image:TwoBufferAndCopies.jpg|thumb|Closeup of the LM 342 with buffer wiring and OpAmp 1 copy wiring]]
[[Image:TwoBufferAndCopiesAndMeasurements.jpg|thumb|loseup of the LM 342 with buffer wiring and OpAmp 1 copy wiring; includes four measurement wires (dark green) - reference voltages for these wires in the top blue row and connected to ground]]]]
+
[[Image:TwoBufferAndCopiesAndMeasurements.jpg|thumb|Closeup of the LM 342 with buffer wiring and OpAmp 1 copy wiring; includes four measurement wires (dark green) - reference voltages for these wires in the top blue row and connected to ground]]
 +
 
 +
<br clear=all>
 +
=== Oscilloscope ===
 +
[[Image:ActiveFilterScope.PNG|thumb|Oscilloscope showing four measurement channels with Channel 0 measuring a signal with an approximate maximum amplitude of 1 V]]
 +
 
 
Click on the pictures at right to make them larger.
 
Click on the pictures at right to make them larger.
  
 
+
-->
[[Category:EGR 119]]
+
[[Category:EGR 224]]

Latest revision as of 12:31, 7 April 2020

The following page provides some supplemental information for the Active Filters lab for EGR 224L. It has been updated to Spring, 2020.

Requirements

You will need access to MATLAB with the Signal Processing Toolbox. You can use MATLAB on the Duke system if you connect via VPN; see How To Get Work Done for more on that. Then use a terminal program to connect to Duke. Run the command

xeyes &

to make sure graphics are working. Note that you will not be able to use MATLAB to play the audio this way, but I have uploaded WAV versions of the files so you can still hear the sounds.

You can also use a Virtual Computer from Duke if you do not want to install MATLAB on your own machine. The VCL page has more information on that. One advantage of this is that you can play the audio through MATLAB.

Finally, you can install MATLAB on your own computer. If you installed MATLAB on your own computer but do not have the Signal Processing Toolbox:

  • Go to the HOME tab
  • Find and click on "Add-Ons"
  • Search for Signal Processing
  • Click on the link for the Signal Processing Toolbox
  • Sign in to install if need be
  • Install

Script from 7.4.2

clear
load DukeFightSong
%% Filter constants
R = 10000;   C = 50e-9;

%% Experimental Transfer Function
[EstH, EstF] = tfestimate(SoundIn, SoundOut, [], [], [], samplerate);
EstMag = abs(EstH);
EstOmega = EstF*2*pi;
%% Analytical Transfer Function
s = tf([1 0], [1]);
H = 1 / (1 + s * R * C);
[HMag, HPhase, HOmega] = bode(H, {1, max(EstOmega)});
HMag = squeeze(HMag);
%% Make plot
figure(1); clf
semilogx(EstOmega, 20*log10(EstMag), 'b-')
hold on
semilogx(HOmega, 20*log10(HMag), 'r-')
hold off
xlabel('\omega, rad/s'); ylabel('|H|, dB')
legend('Estimates', 'Theoretical', 'location', 'best')