Fir Equiripple Order Estimation
Main Software Page

```10 REM PROGRAM FOR EMPIRICAL ORDER ESTIMATION OF FIR FILTERS.
20 DEFDBL A-Z
30 INPUT "LOWPASS(0), BANDPASS(1), BANDSTOP(2), OR HIGHPASS(3) ? ";ITYPE
40 INPUT "TYPE MAXIMUM PASSBAND ATTENUATION IN DB ";AF1
50 INPUT "TYPE MINIMUM STOPBAND ATTENUATION IN DB ";AF2
60 INPUT "TYPE SAMPLING FREQUENCY IN HERTZ ";SFREQ
70 IF (ITYPE=1) OR (ITYPE=2) THEN PRINT " THE FILTER RESPONSE IS ASSUMED TO BY SYMMETRICAL ABOUT";SFREQ*.25;"HZ"
80 INPUT "TYPE FIRST PASSBAND EDGE FREQUENCY IN HERTZ ";F1
90 INPUT "TYPE FIRST STOPBAND EDGE FREQUENCY IN HERTZ ";F2
100 F1 = F1/SFREQ
110 F2=F2/SFREQ
120 IF ITYPE = 1 THEN F1=.5-2*F1:F2=.5-2*F2
130 IF ITYPE = 2 THEN F1=2*F1:F2=2*F2
140 IF ITYPE = 3 THEN F1=.5-F1:F2=.5-F2
150 D1 =  .5*(1-10^(-AF1/20))
160 D2 = 10^(-AF2/20)
170 DELOMG = -(F1-F2)
180 REM FILTER LENGTH ESTIMATION
190 DL1 = LOG(D1)/LOG(10)
200 DL2 = LOG(D2)/LOG(10)
210 DQ1 = DL1*DL1
220 D = .005309*DQ1+.07114*DL1-.4761
230 D = D*DL2
240 D = D-.00266*DQ1-.5941*DL1-.4278
250 D = 2+D/DELOMG
260 NF = D
270 NF = INT(NF)
280 IF (ITYPE=1) OR (ITYPE=2) THEN NF=2*D
290 IF ((ITYPE=2) OR (ITYPE=3)) AND (NF MOD 2 = 0) THEN NF = NF + 1
300 PRINT "THE FILTER LENGTH IS ";NF
310 ALD=LOG(D1)/LOG(10)
320 ALS=LOG(D2)/LOG(10)
330 ALO=LOG(DELOMG*360)/LOG(10)
340 W=7.22116-.589268*ALD+(.112354*ALD-2.328539)*ALO-3.559051*ALS
350 PRINT "THE WORD LENGTH IS ";INT(W+1)

```
Main Software Page