# Digital Filters

CCICAP can be used to study digital networks using the following four network elements:

• Input Node - IN
• Output Node - OUT
• Multiplier Node - MUL
• Delay Node - DEL

Finite Impulse Response and Infinite Impulse Response digital filters are readily simulated using these elements.

Digital filters can be quickly designed using the Interactive Digital Filter Design tool from the University of York. Specifying a fourth order Butterworth filter with a 0.1 Hz corner and 1.0 sps sample rate gives the following difference equation representation:

```y[n] = (  1 * x[n- 4])
+ (  4 * x[n- 3])
+ (  6 * x[n- 2])
+ (  4 * x[n- 1])
+ (  1 * x[n- 0])

+ ( -0.1873794924 * y[n- 4])
+ (  1.0546654059 * y[n- 3])
+ ( -2.3139884144 * y[n- 2])
+ (  2.3695130072 * y[n- 1])
```

Using the digital elements in CCICAP the difference equation can be directly realized as follows.

```.title Digital Filter - 4th order Butterworth

.ac 100 0. 0.5

.plot ac png eout 0. 1.1
.plot ac png eout >
.plot ac png SSM

.opt mag

' relative sensitivity of multiplier m6
.sensr m6
.ssens

.ckt

in ein in 0 1.
mul m0 in 1 1.

del d1 1 2
del d2 2 3
del d3 3 4
del d4 4 5

mul m1 1 10 1.
mul m2 2 10 4.
mul m3 3 10 6.
mul m4 4 10 4.
mul m5 5 10 1.

del d5 10 6
del d6 6 7
del d7 7 8
del d8 8 9

mul m6 6 10 2.3695130072
mul m7 7 10 -2.3139884144
mul m8 8 10 1.0546654059
mul m9 9 10 -0.1873794924

' normalize the output
mul mout 10 11 { 1. 4. + 6. + 4. + 1. + \
1 2.3695130072 - -2.3139884144 - 1.0546654059 - \
-0.1873794924 - / 1 XY / }

out eout 11 0

.end

.go

' relative sensitivity of multiplier m9
.sensr m9

'repeat
.go

.stop
```

The frequency response of the filter is shown here:

This example also calculates the sensitivity of the first output (eout) to the value of two of the multiplier elements, m6 and m9. The magnitude of the two sensitivities is shown here (as expected, the sensitivity to m6 is much larger than that to m9): Sensitivity of eout to changes in m6 Sensitivity of eout to changes in m9