Contents
RC Frequency Domain Demo
/home/dimarzio/Documents/working/12229/lectures/rcfreq.m Sun Oct 29 13:07:12 2017 Chuck DiMarzio, Northeastern University See Lecture notes for week 9, EECE2150
f=10.^[0:0.01:6]; omega=2*pi*f; R=10e3;C=10e-6; Zc=1./(1j*omega*C); Av=Zc./(R+Zc);
Plot and Check: Did I do my math right?
Acheck=(1-1j*omega*R*C)./(1+(omega*R*C).^2); f1=figure;semilogx(f,abs(Av));grid on; xlabel('f, Frequency, Hz');ylabel('Gain Magnitude'); figure;semilogx(f,angle(Av)*180/pi);grid on; xlabel('f, Frequency, Hz');ylabel('Gain Phase, Deg.'); figure;semilogx(f,abs(Av-Acheck));grid on; xlabel('f, Frequency, Hz');ylabel('Gain Error'); % Yup. The math was right
Locate the cutoff frequency and the frequency at Av=0.1
f707=1.59;A707=(1-1j*2*pi*f707*R*C)./(1+(2*pi*f707*R*C).^2); f10=15.8;A10=(1-1j*2*pi*f10*R*C)./(1+(2*pi*f10*R*C).^2); figure(f1);hold on; semilogx(f707,abs(A707),'o'); semilogx(f10,abs(A10),'+'); hold off;
Do it in dB (Note 20 dB per decade)
figure;semilogx(f,20*log10(abs(Av)));grid on; xlabel('f, Frequency, Hz');ylabel('Gain, dB');
Add 600 ohm load and do it again
RL=600; AvL=(1./(1./Zc+1/RL))./(R+1./(1./Zc+1/RL)); figure;semilogx(f,abs(Av),f,abs(AvL));grid on; xlabel('f, Frequency, Hz');ylabel('Gain Magnitude'); figure;semilogx(f,20*log10(abs(Av)),f,20*log10(abs(AvL)));grid on; xlabel('f, Frequency, Hz');ylabel('Gain, dB'); % That's really bad!
Bandpass filters with Op-Amps
f=10.^[0:0.01:6]; omega=2*pi*f;
low-frequency audio bandpass
R1=10e3;C1=1e-6;R2=20e3;C2=0.02e-6; Zc1=1./(1j*omega*C1); Zc2=1./(1j*omega*C2); Z1=R1+Zc1; Z2=1./(1./R2+1./Zc2); Av=-Z2./Z1; figure;semilogx(f,20*log10(abs(Av)));grid on; xlabel('f, Frequency, Hz');ylabel('Gain, dB'); % Note Midband gain determined by resistors
Another filter for the next part of the spectrum
C1=C1/60;C2=C2/5; Zc1=1./(1j*omega*C1); Zc2=1./(1j*omega*C2); Z1=R1+Zc1; Z2=1./(1./R2+1./Zc2); Av2=-Z2./Z1; figure;semilogx(f,20*log10(abs(Av)),f,20*log10(abs(Av2)));grid on; xlabel('f, Frequency, Hz');ylabel('Gain, dB'); % Note we fall short of the desired midband gain