# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# freqsamp

Real or complex frequency-sampled FIR filter from specification object

## Syntax

```hd = design(d,'freqsamp') hd = design(...,'FilterStructure',structure) hd = design(...,'Window',window) ```

## Description

`hd = design(d,'freqsamp')` designs a frequency-sampled filter specified by the filter specifications object `d`.

`hd = design(...,'FilterStructure',structure)` returns a filter with the filter structure you specify by the `structure` input argument. `structure` is `dffir` by default and can be any one of the following filter structures.

Structure

Description of Resulting Filter

`dffir`

Direct-form FIR filter

`dffirt`

Transposed direct-form FIR filter

`dfsymfir`

Symmetrical direct-form FIR filter

`dfasymfir`

Asymmetrical direct-form FIR filter

`fftfir`

Fast Fourier transform FIR filter

`hd = design(...,'Window',window)` designs filters using the window specified in `window`. Provide the input argument `window` as

• The window name in single quotes. For example, use `'bartlett'`, or `'hamming'`. See `window` for the full list of available windows.

• A function handle that references the `window` function. When the `window` function requires more than one input, use a cell array to hold the required arguments. The first example shows a cell array input argument.

• The window vector itself.

## Examples

collapse all

Design FIR filters that have arbitrary magnitude responses.

Initially, generate a real filter whose response has three distinct sections:

• A sinusoidal response section for lower frequencies

• A piecewise linear response section for intermediate frequencies

• A quadratic response section for higher frequencies.

```b1 = 0:0.01:0.18; a1 = 0.5+sin(2*pi*7.5*b1)/4; b2 = [0.2 0.38 0.4 0.55 0.562 0.585 0.6 0.78]; a2 = [0.5 2.3 1 1 -0.2 -0.2 1 1]; b3 = [0.79:0.01:1]; a3 = 0.2+18*(1-b3).^2; f = [b1 b2 b3]; a = [a1 a2 a3]; n = 300;```

Design the filter using a Kaiser window with β = 50;

```d = fdesign.arbmag('n,f,a',n,f,a); hd = design(d,'freqsamp','Window',{@kaiser,50}); fvtool(hd)```

Design an arbitrary-magnitude complex FIR filter. The vector `f` contains frequency locations. The vector `a` contains the desired filter response values at the locations specified in `f`. Use a rectangular window for the design.

```f = [-1 -0.93443 -0.86885 -0.80328 -0.7377 -0.67213 -0.60656 -0.54098 ... -0.47541 -0.40984 -0.34426 -0.27869 -0.21311 -0.14754 -0.081967 ... -0.016393 0.04918 0.11475 0.18033 0.2459 0.31148 0.37705 0.44262 ... 0.5082 0.57377 0.63934 0.70492 0.77049 0.83607 0.90164 1]; a = [0.0095848 0.021972 0.047249 0.099869 0.23119 0.57569 0.94032 ... 0.98084 0.99707 0.99565 0.9958 0.99899 0.99402 0.99978 ... 0.99995 0.99733 0.99731 0.96979 0.94936 0.8196 0.28502 ... 0.065469 0.0044517 0.018164 0.023305 0.02397 0.023141 0.021341 ... 0.019364 0.017379 0.016061]; n = 48; d = fdesign.arbmag('n,f,a',n,f,a); hdc = design(d,'freqsamp','Window','rectwin'); fvtool(hdc)```

FVTool shows the response for `hdc` from -1 to 1 in normalized frequency because the filter's transfer function is not symmetric around 0. Since the Fourier transform of the filter does not exhibit conjugate symmetry, `design` returns a complex-valued filter.