Difference between revisions of "EGR 224/Active Filter"

From PrattWiki
Jump to navigation Jump to search
m
Line 1: Line 1:
The following page provides some supplemental information for the '''Active Filters ''' lab for [[EGR 224|EGR 224L]].  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, 2016.
 +
 
 +
== 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', 0)
 +
</source>
 +
<!--
 
== Points of Clarification ==
 
== 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.
 
* 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.
Line 15: Line 42:
 
Click on the pictures at right to make them larger.
 
Click on the pictures at right to make them larger.
  
 
+
-->
 
[[Category:EGR 224]]
 
[[Category:EGR 224]]

Revision as of 19:19, 10 April 2016

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

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', 0)