% vcvs_typ.m - VCVS LP filter types - Fig 5.16, p. 274 in H&H % HJSIII - 98.07.09 clear clf % cutoff frequency (Hz) fc = 1 / (2*pi*R*C) % capacitor (Farads) fc = 15; C = 0.1E-6; C1 = C; C2 = C; % single-stage second-order passband gain % K fn % Butterworth 1.586 1 % Bessel 1.268 1.272 % 2dB Chebyshev 2.114 0.907 K_but = 1.586; K_bes = 1.268; K_che = 2.114; fn_but = 1; fn_bes = 1.272; fn_che = 0.907; R_but = 1 / (2*pi*fc*C*fn_but); R_bes = 1 / (2*pi*fc*C*fn_bes); R_che = 1 / (2*pi*fc*C*fn_che); % use 0.1 Hz <= f <= 1000 lf = -1:0.01:3; f = 10 .^ lf; % capacitor impedance ZC1 = -j ./ ( 2 * pi * f * C1 ); ZC2 = -j ./ ( 2 * pi * f * C2 ); % gain % gain K = K_but; R1 = R_but; R2 = R_but; G_but = K.*ZC1.*ZC2 ./ ( ( R1+ZC1).*( R2+ZC2) + R1*(ZC1- K*ZC2) ); K = K_bes; R1 = R_bes; R2 = R_bes; G_bes = K.*ZC1.*ZC2 ./ ( ( R1+ZC1).*( R2+ZC2) + R1*(ZC1- K*ZC2) ); K = K_che; R1 = R_che; R2 = R_che; G_che = K.*ZC1.*ZC2 ./ ( ( R1+ZC1).*( R2+ZC2) + R1*(ZC1- K*ZC2) ); % gain in dB and phase in degrees dB_but = 20 * log10( abs( G_but ) ); dB_bes = 20 * log10( abs( G_bes ) ); dB_che = 20 * log10( abs( G_che ) ); phi_but = angle( G_but ) * 180 / pi; phi_bes = angle( G_bes ) * 180 / pi; phi_che = angle( G_che ) * 180 / pi; % plots subplot(2,1,1) plot( lf,dB_but, lf,dB_bes,'--', lf,dB_che,':' ) axis( [ -1 3 -40 10 ] ) title( 'VCVS 100 Hz LP filter types' ) xlabel( 'log f' ) ylabel( 'Gain (dB)' ) legend( 'Butterworth', 'Bessel', '2dB Chebyshev' ) subplot(2,1,2) plot( lf,phi_but, lf,phi_bes,'--', lf,phi_che,':' ) axis( [ -1 3 -190 10 ] ) xlabel( 'log f' ) ylabel( 'Phase (deg)' ) hold on