Elliptic Poles Calculation
Main Software Page
10 DEFDBL A-Z
20 DIM C1(100),B1(100),A1(100),D1(100),Z1(100),F1(100)
30 INPUT "Passband ripple in db ";AX
40 INPUT "Filter order ";FILORD
50 FOR I = 1 TO FILORD/2
60 INPUT F(I)
70 NEXT I
80 RP=AX:FB=1/(2*3.141592654#):NIN=FILORD MOD 2:N=INT(FILORD/2)
90 FOR I = 1 TO N
100 F1(I)=F(N+1-I)/(2*3.141592654#)
110 NEXT I
120 EE=10^(.1*RP)-1:E=SQR(EE):FBB=FB*FB
130 M=NIN+2*N:EM=2*INT(M/2):TP=2*3.14159:K=0:T=M:R=0
140 FOR I = 1 TO N:Z1(I)=SQR(1-FBB/F1(I)/F1(I)):NEXT I
150 FOR I = 1 TO N:W1(I) = TP*F1(I):NEXT I
160 GOSUB 370: GOSUB 690
170 PRINT " POLES ZEROES"
180 IF M>EM THEN C1(2*M)=0
190 FOR I = 0 TO 2*M STEP 2:A1(M-I/2)=C1(I)+D1(I):NEXT I
200 GOSUB 790
210 R=R+1:P(R)=P(R)/10:Q1(R)=Q1(R)/100:D=1+P(R)+Q1(R)
220 B1(R)=(1+P(R)/2)*FBB/D
230 ZF1(R)=FB/D^.25
240 ZQ1(R)=1/SQR(ABS(2*(1-B1(R)/(ZF1(R)*ZF1(R)) ))):ZW1(R)=TP*ZF1(R)
250 GAIN2=GAIN2/ZW1(R)^2
260 ROOT(R,1)=-.5*( ZW1(R))/ZQ1(R):ROOT(R+EM/2,1)=ROOT(R,1)
270 ROOT(R,2)=.5*SQR(ABS(ZW1(R)^2/ZQ1(R)^2 - 4*ZW1(R)^2)):ROOT(R+EM/2,2)=-ROOT(R,2)
280 PRINT ROOT(R,1),ROOT(R,2)
290 IF R<(EM/2) THEN GOTO 210
300 IF A=0 THEN GOTO 340
310 SIGMA=SQR(FBB/(.1*A-1))*TP
320 GAIN2=GAIN2/SIGMA
330 ROOT(R+1+EM/2,1)=-SIGMA:PRINT -SIGMA
340 REM
350 REM
360 STOP
370 REM determination of f(z)
380 FOR I = 1 TO NIN:S1(I)=1:NEXT I
390 FOR I = NIN+1 TO NIN+N:S1(I)=Z1(I-NIN):NEXT I
400 FOR I = NIN+N+1 TO NIN+2*N: S1(I)=Z1(I-NIN-N):NEXT I
410 SN=I-1 :GOSUB 540
420 FOR I = 0 TO EM STEP 2:A1(I)=E*B1(I):NEXT I
430 FOR I = 0 TO 2*EM STEP 2
440 GOSUB 630
450 NEXT I
460 RETURN
540 REM prod(x+s(i)
550 B1(0)=S1(1):B1(1)=1:J=1
560 J=J+1
570 A1(0)=S1(J)*B1(0)
580 FOR I = 1 TO J-1:A1(I)=B1(I-1)+S1(J)*B1(I):NEXT I
590 FOR I = 0 TO J-1:B1(I)=A1(I):NEXT I
600 B1(J)=1
610 IF J < SN THEN GOTO 560
620 RETURN
630 REM determination of f(z)^2
640 IF I < (EM+2) THEN JI=0:JF=I
650 IF I > EM THEN JI=I-EM:JF=EM
660 C1(I)=0
670 FOR J=JI TO JF STEP 2:C1(I)=C1(I)+A1(J)*(A1(I-J)*10^(M-I/2) ):NEXT J
680 RETURN
690 REM determination of q(z)
700 FOR I = 1 TO NIN
710 S1(I)=-10
720 NEXT I
730 FOR I = NIN+1 TO NIN+N:S1(I)=-10*Z1(I-NIN)^2:NEXT I
740 FOR I = NIN+N+1 TO NIN+2*N:S1(I)=S1(I-N):NEXT I
750 SN=M:GOSUB 540
760 DD=(-1)^NIN
770 FOR I = 0 TO 2*M STEP 2:D1(I)=DD*B1(I/2):NEXT I
780 RETURN
790 REM factor findre
800 FOR I = 1 TO T:A1(I)=A1(I)/A1(0):NEXT I
810 A1(0)=1:B1(0)=1:C1(0)=1:I1=0
820 P=0:Q=0:I1=I1+1
830 B1(1)=A1(1)-P:C1(1)=B1(1)-P
840 FOR I = 2 TO T:B1(I)=A1(I)-P*B1(I-1)-Q*B1(I-2):NEXT I
850 FOR I = 2 TO T-1:C1(I)=B1(I)-P*C1(I-1)-Q*C1(I-2):NEXT I
860 X1=T-1:X2=T-2:X3=T-3:X4=C1(X2)^2+C1(X3)*(B1(X1)-C1(X1))
870 IF X4=0 THEN X4=.001
880 DDP=(B1(X1)*C1(X2)-B1(T)*C1(X3))/X4:P=P+DDP
890 DQ=(B1(T)*C1(X2)-B1(X1)*(C1(X1)-B1(X1)))/X4:Q=Q+DQ
900 IF ABS(DDP+DQ) >.000001 THEN GOTO 830
910 P(I1)=P:Q1(I1)=Q:A1(1)=A1(1)-P:T=T-2
920 FOR I = 2 TO T:A1(I)=A1(I)-P*A1(I-1)-Q*A1(I-2):NEXT I
930 IF T>2 THEN GOTO 820
940 IF T=2 THEN I1=I1+1:P(I1)=A1(1):Q1(I1)=A1(2)
950 IF T=1 THEN A=-A1(1)
960 RETURN
Example B3.1
The parameter, NIN, is the number of zeroes at infinity and has been programmed so that NIN = 1 for odd order elliptic filters, and NIN = 0 for even order type-a elliptic filters. The program would require modification to accommodate type-b and type-c elliptic filters. The input data for program B3 can be taken directly from the output of program B2.
Using the values given in equation (7.27),
Passband ripple in db ? 3.0103
Filter order ? 6
? 1.0698388
? 1.2206966
? 2.64008339
Poles Zeroes
-1.166030792904782D-02 ±0.9937640520822193
-6.642337324484707D-02 ±0.8808912341937725
-0.20341647439428 ±0.4197740742320909
From the pole locations given by program B3, the transfer function corresponding to example 7.5 is
G(s)=
|
.
|
where
(s2 + 0.407s + 0.2178) = [s - (-0.2034 + j 0.41977)][s - (-0.2034 - j 0.41977)],
(s2 + 0.133s + 0.7804) = [s - (-0.0664 + j 0.88089)][s - (-0.0664 - j 0.88089)],
(s2 + 0..234s + 0.9877) = [s - (-0..01166+ j 0.9938)][s - (-0.01166 - j 0.9938)].
Main Software Page