Contents
Low Pass
clear
s = tf('s');
ww=.01:1:1e5;
wc=25000;
[z p k]=buttap(4);
[num den]=lp2lp(k*poly(z),poly(p),wc);
LP=tf(num,den);P=pole(LP);Z=zero(LP);
LP1=tf(1e9,poly(P(1:2)));
LP2=tf(4e8,poly(P(3:4)));
K1=1.6;Q1=1.3089;
BQ1=(K1)/(s^2/wc^2+s/(wc*Q1)+1);
K2=.64;Q2=.54124;
BQ2=(K2)/(s^2/wc^2+s/(wc*Q2)+1);
[LPmag LPphase]=bode(LP,ww);
[LP1mag LP1phase]=bode(LP1,ww);
[LP2mag LP2phase]=bode(LP2,ww);
[BQ1mag BQ1phase]=bode(BQ1,ww);
[BQ2mag BQ2phase]=bode(BQ2,ww);
figure(1);clf;
subplot(211),pzplot(LP)
legend('Desired pzplot','Location','East')
subplot(212),pzplot(LP1,LP2)
legend('Biquad 1','Biquad 2','Location','East')
figure(2);clf;
subplot(211),plot(ww,LP1mag(:,:).*LP2mag(:,:),'b',ww,LPmag(:,:),'k:')
legend('Designed response','Desired response')
subplot(212),plot(ww,BQ1mag(:,:),'b',ww,BQ2mag(:,:),'r',ww,LP1mag(:,:),'k:',ww,LP2mag(:,:),'k:')
legend('Biquad 1 - designed','Biquad 2 - designed')
Designing the Sallen-Key filters to implement my low-pass
clear
s = tf('s');
ww=.01:1:1e5;
wc=25000;
K1=1.6;Q1=1.3089;
BQ1=(K1)/(s^2/wc^2+s/(wc*Q1)+1);
K2=.64;Q2=.54124;
BQ2=(K2)/(s^2/wc^2+s/(wc*Q2)+1);
C1=56e-9;C2=8.2e-9;R1=1.2e3;R2=3e3;
C1=39e-9;
Circ1=K1/(R1*R2*C1*C2*s^2+(R1*C2+(1-K1)*R1*C1)*s+1);
C1=5.6e-9;C2=5.6e-9;R1=10e3;R2=5.1e3;
Circ2=K2/(R1*R2*C1*C2*s^2+(R1*C2+(1-K2)*R1*C1)*s+1);
[BQ1mag BQ1phase]=bode(BQ1,ww);
[BQ2mag BQ2phase]=bode(BQ2,ww);
[Circ1mag Circ1phase]=bode(Circ1,ww);
[Circ2mag Circ2phase]=bode(Circ2,ww);
figure(3);clf;
subplot(211),plot(ww,Circ1mag(:,:).*Circ2mag(:,:),ww,BQ1mag(:,:).*BQ2mag(:,:),'k:')
subplot(212),plot(ww,Circ1mag(:,:),'b',ww,Circ2mag(:,:),'r',ww,BQ1mag(:,:),'k:',ww,BQ2mag(:,:),'k:')
Results