---
name: "rtf_create_filter"
section: "3"
platform: "linux"
package: "librtfilter-dev"
version: "1.1-4+b3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rtf_create_filter"
---

# rtf\_create\_filter(3)

Creates a custom filter

## NAME

rtf\_create\_filter - Creates a custom filter

## SYNOPSIS

**#include \<rtfilter.h\>**

**hfilter rtf\_create\_filter(unsigned int** *nchann***, int** *proctype***,**\
                           **unsigned int** *num\_len***, const void \****num***,**\
                           **unsigned int** *denum\_len***, const void \****denum***,**\
                           **int** *type***);**\

## DESCRIPTION

This function creates and initializes a digital linear filter whose the Z-transform is rational and processing *nchann* channels of a data type specified by *proctype*.

The numerator and denominator of the rational expression are specified by respectively two arrays *num* and *denum* containing the coefficients in the ascending order of the 2 polynoms. The number of elements in each arrays is controlled by *num\_len* and enum\_len. *denum\_len* is allowed to be equal to zero as well as *denum* is allowed to be NULL. In such case, the denominator will be set to 1. The data type of the values in *num* and *denum* are specified by *type*.

The *proctype* and *type* must be one the following constants:

-

  **RTF\_FLOAT** specifies real single precision (**float**)

-

  **RTF\_DOUBLE** specifies real double precision (**double**)

-

  **RTF\_CFLOAT** specifies complex single precision (**complex float**)

-

  **RTF\_CDOUBLE** specifies complex double precision (**complex double**)

The expected data type of the output of the filter has the same precision as the one specified by *proctype* and is complex *proctype* or *type* specifies a complex type. Said otherwise:

- \*

  If *proctype* is **RTF\_FLOAT** or **RTF\_CFLOAT** then the output data type will have single precision. Otherwise it will have double precision.

- \*

  If *proctype* or *type* specifies a complex type, then the output will be complex as well. Otherwise, it will be real.

**rtf\_create\_filter**() can be used to use a filter that has been designed somewhere else. In particular, this function can be used directly with the output of filter design function of MATLAB. In such case, the usual B and A arrays returned by the filter design functions corresponds exactly to respectively *num* and *denum*.

## RETURN VALUE

Returns the handle to the created filter in case of success, NULL otherwise.

## PERFORMANCE CONSIDERATION

See note of [**rtf\_filter**(3)](/rtf_filter/3.md)

## SEE ALSO

[**rtf\_destroy\_filter**(3)](/rtf_destroy_filter/3.md), [**rtf\_init\_filter**(3)](/rtf_init_filter/3.md), [**rtf\_filter**(3)](/rtf_filter/3.md)
