2.1.22.3.3 ocmsp_filtfilt


Description

Zero-phase digital filtering

Syntax

int ocmsp_filtfilt( const double * px, double * py, UINT n, const double * pb, UINT nb, const double * pa, UINT na )

Parameters

px
[input] input data
py
[output] output data
n
[input] size of data
pb
[input] filter numerator coefficients
nb
[input] size of numerator coefficients
pa
[input] filter denominator coefficients
na
[input] size of denominator coefficients

Return

Return OE_NOERROR if succeed, otherwise, non-zero error code is returned (OE_NULL_POINTER or OE_INVALID_SIZE)

Examples

EX1

#include <ocmsp.h>
void ocmsp_filtfilt_ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if(!wks)
        return;

    vector& vx = wks.Columns(0).GetDataObject();
    vector& vy = wks.Columns(1).GetDataObject();
    vector b = {0.018886917952608, 0.169982261573470, 0.679929046293879,
                1.586501108019050, 2.379751662028575, 2.379751662028575,
                1.586501108019050, 0.679929046293879, 0.169982261573470,
                0.018886917952608};
    vector a = {1.000000000000000, 1.791581352788596, 2.531899880898121,
                2.118229420341933, 1.370756294393234, 0.609038913076474,
                0.199331556962956, 0.043104731015281, 0.005804261654309,
                0.000355580604258};

    int nRet = 0, n = vx.GetSize(), na = a.GetSize(), nb = b.GetSize();
    if (0 != (nRet = ocmsp_filtfilt(vx, vy, n, b, nb, a, na)))
    {
        printf("ocmsp_filtfilt failed, error code=%d\n", nRet);
        return;
    }
}

Remark

See Also

ocmsp_filter, ocmsp_filter_sos, ocmsp_filtfilt_sos

Header to Included

ocmsp.h

Reference