ocmsp_writefcf

 

Description

Write filter coefficients to Matlab fcf file

Syntax

int ocmsp_writefcf( const char * filename, const double * pb, UINT nb, const double * pa, UINT na, int fmt = OMSP_DEC )

Parameters

filename
[input] file name
pb
[input] filter numerator coefficients
nb
[input] size of numerator coefficients
pa
[input] filter denominator coefficients
na
[input] size of denominator coefficients
fmt
[input] format of coefficients, in binary(OMSP_BIN), decimal(OMSP_DEC) or hexadecimal(OMSP_HEX)

Return

Return OE_NOERROR if succeed. non-zero error code is returned (OE_OPEN_FILE_FAILED, OE_WRITE_FILE_FAILED)

Examples

EX1

#include <ocmsp.h>
void ocmsp_write_fcf_ex1()
{
    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, na = a.GetSize(), nb = b.GetSize();    
    const char* filename = "d:\\filter_tf.fcf";
    if (0 != (nRet = ocmsp_writefcf(filename, b, nb, a, na, OMSP_DEC)))
    {
        printf("ocmsp_writefcf failed, error code = %d\n", nRet);
        return;
    }
}

Remark

See Also

ocmsp_writefcf_sos, ocmsp_writefcf_ss

header to Included

ocmsp.h

Reference