Difference between revisions of "EGR 224/Active Filter"
Jump to navigation
Jump to search
Line 24: | Line 24: | ||
hold off | hold off | ||
xlabel('\omega, rad/s'); ylabel('|H|, dB') | xlabel('\omega, rad/s'); ylabel('|H|, dB') | ||
− | legend('Estimates', 'Theoretical', | + | legend('Estimates', 'Theoretical', 'location', 'best') |
</source> | </source> | ||
<!-- | <!-- |
Revision as of 13:37, 27 September 2017
The following page provides some supplemental information for the Active Filters lab for EGR 224L. It has been updated to Spring, 2017.
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')