# getBandwidth

Get 3 dB bandwidth

## Syntax

``BW = getBandwidth(npFilter)``

## Description

example

````BW = getBandwidth(npFilter)` returns the 3 dB bandwidth for the notch peak filter. If the `Specification` property is set to ```'Quality factor and center frequency'```, the 3 dB bandwidth is determined from the quality factor value. If the `Specification` property is set to `'Coefficients'`, the 3 dB bandwidth is determined from the `BandwidthCoefficient` value and the sample rate.```

## Examples

collapse all

Create a `dsp.NotchPeakFilter` object. Set the `Specification` property to `'Quality factor and center frequency'` and the `NormalizedFrequency` property to `true`. The default quality factor Q is 5, and the center frequency Fc is 0.5 in normalized units.

```np = dsp.NotchPeakFilter(Specification='Quality factor and center frequency',... NormalizedFrequency=true)```
```np = dsp.NotchPeakFilter with properties: Specification: 'Quality factor and center frequency' QualityFactor: 5 CenterFrequency: 0.5000 NormalizedFrequency: true ```

Compute the 3 dB bandwidth of the notch peak filter using the `getBandwidth` function. The function computes the bandwidth as the ratio of the center frequency and the quality factor, $\frac{\mathrm{Fc}}{\mathit{Q}}$. Since Fc is in normalized units, the function computes the 3 dB bandwidth in normalized units.

`getBandwidth(np)`
```ans = 0.1000 ```

Visualize the filter response.

`filterAnalyzer(np)`

## Input Arguments

collapse all

Notch peak filter whose 3 dB bandwidth is measured, specified as a `dsp.NotchPeakFilter` object.

## Output Arguments

collapse all

3 dB bandwidth of the filter, returned as a scalar.

Data Types: `double`

## Version History

Introduced in R2014a

expand all