ocmsp_filter

 

Description

Filter data sequence using a digital filter

Syntax

int ocmsp_filter( const double * px, double * py, UINT n, const double * pb, UINT nb, const double * pa, UINT na, const double * pzi = NULL, double * pzf = NULL )

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
pzi
[input][optional] initial codition of delays, length is max(na, nb)-1
pzf
[output][optional] final condition of delays, length is max(na, nb)-1

Return

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

Examples

EX1

#include <ocmsp.h>
void ocmsp_filter_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_filter(vx, vy, n, b, nb, a, na, NULL, NULL)))
    {
        printf("ocmsp_filter failed, error ocde=%d\n", nRet);
        return;
    }
}

Remark

See Also

ocmsp_filter_sos, ocmsp_filtfilt, ocmsp_filtfilt_sos

header to Included

ocmsp.h

Reference