# Create Tunable Second-Order Filter

This example shows how to create a parametric model of the second-order filter:

`$F\left(s\right)=\frac{{\omega }_{n}^{2}}{{s}^{2}+2\zeta {\omega }_{n}s+{\omega }_{n}^{2}},$`

where the damping $\zeta$ and the natural frequency ${\omega }_{n}$ are tunable parameters.

Define the tunable parameters using `realp`.

```wn = realp('wn',3); zeta = realp('zeta',0.8);```

`wn` and `zeta` are `realp` parameter objects, with initial values `3` and `0.8`, respectively.

Create a model of the filter using the tunable parameters.

`F = tf(wn^2,[1 2*zeta*wn wn^2]);`

The inputs to `tf` are the vectors of numerator and denominator coefficients expressed in terms of `wn` and `zeta`.

`F` is a `genss` model. The property `F.Blocks` lists the two tunable parameters `wn` and `zeta`.

`F.Blocks`
```ans = struct with fields: wn: [1x1 realp] zeta: [1x1 realp] ```

You can examine the number of tunable blocks in a generalized model using `nblocks`.

`nblocks(F)`
```ans = 6 ```

`F` has two tunable parameters, but the parameter `wn` appears five times - Twice in the numerator and three times in the denominator.

To reduce the number of tunable blocks, you can rewrite `F` as:

`$F\left(s\right)=\frac{1}{{\left(\frac{s}{{\omega }_{n}}\right)}^{2}+2\zeta \left(\frac{s}{{\omega }_{n}}\right)+1}.$`

Create the alternative filter.

`F = tf(1,[(1/wn)^2 2*zeta*(1/wn) 1]);`

Examine the number of tunable blocks in the new model.

`nblocks(F)`
```ans = 4 ```

In the new formulation, there are only three occurrences of the tunable parameter `wn`. Reducing the number of occurrences of a block in a model can improve the performance of calculations involving the model. However, the number of occurrences does not affect the results of tuning the model or sampling it for parameter studies.