# cheb2ord

Design a Chebyshev II filter.

## Syntax

[n,Wn] = cheb2ord(Wp,Ws,Rp,Rs,domain)

## Inputs

`Wp`- A scalar specifying the passband frequency of a low or high pass filter, or a two element vector specifying the passband frequencies of a bandpass or bandstop filter. For a digital filter the values (in Hz) are normalized relative to the Nyquist frequency. For an analog filter the values are in radians/sec.
`Ws`- A scalar specifying the stopband frequency of a low or high pass filter, or a two element vector specifying the stopband frequencies of a bandpass or bandstop filter. For a digital filter the values (in Hz) are normalized relative to the Nyquist frequency. For an analog filter the values are in radians/sec.
`Rp`- The maximum attenuation in decibels at
`Wp`. `Rs`- The minimum attenuation in decibels at
`Ws`. `domain`-
- Use 'z' for digital filters (default).
- Use 's' for analog filters.

## Outputs

- n
- The lowest filter order that will meet the requirements.
- Wn
- Normalized frequency input for which the requirement is met.

## Example

Design a digital Chebyshev II filter with no more than 1 dB attenuation at 100 Hz and at least 20 dB attenuation at 200 Hz, with a 1000 Hz sampling frequency.

`[n,Wn] = cheb2ord(100/500, 200/500, 1, 20)`

```
n = 3
Wn = 0.34336
```

## Comments

In general, there are a range of corner frequencies for which the requirements can be met
at the lowest order. `Ws` is the largest stopband meeting the design requirement.
`Wn` is the smallest stopband meeting the design requirement.