【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.22.3.12 ocmsp_impz
Contents
Description
Impulse response of digital filter, calculating by coefficients of transfer function.
Syntax
int ocmsp_impz( double * ph, double * pt, UINT n, const double * pb, UINT nb, const double * pa, UINT na, double fs = 1.0 )
Parameters
- ph
- [output] impulse response, size n
- pt
- [output] sample times, size n
- n
- [input] size of impulse response
- pb
- [input] filter numerator coefficients
- nb
- [input] size of numerator coefficients
- pa
- [input] filter denominator coefficients
- na
- [input] size of denominator coefficients
- fs
- [input][optional] sample frequency, the samples are spaced 1/fs unit apart. Default 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_impz_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}; Worksheet wks = Project.ActiveLayer(); if(!wks) return; int nRet = 0, na = a.GetSize(), nb = b.GetSize(); vector& vt = wks.Columns(0).GetDataObject(); vector& vh = wks.Columns(1).GetDataObject(); UINT nh = 0; int type = 0; if (0 != (nRet = ocmsp_impzlength(&nh, b, nb, a, na))) { printf("ocmsp_impzlength failed, error code = %d\n", nRet); return; } vt.SetSize(nh); vh.SetSize(nh); if (0 != (nRet = ocmsp_impz(vh, vt, nh, b, nb, a, na))) { printf("ocmsp_impz failed, error code = %d\n", nRet); return; } }
Remark
See Also
Header to Included
ocmsp.h