Showing results for

- Intel Community
- Software Development SDKs and Libraries
- Intel® Integrated Performance Primitives
- IppsFIR and Initial Conditions

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted
##

I'm trying to use IppsFIR() to get the same results as the MatLab function filter(). For example, if I do the following call in ML:

y = filter( b, 1, x );

and then use the IPP functions():

IppsFIRState_64f *pState;

ippsFIRInitAlloc( &pState, *b, lenb, NULL );

ippsFIR( *x, *y, lenx, pState );

I get the same results in ML and IPP.

But if I do the following in MatLab:

y = filter( b, 1, x, zi );

and the following in IPP:

IppsFIRState_64f *pState;

ippsFIRInitAlloc( &pState, *b, lenb, *zi );

ippsFIR( *x, *y, lenx, pState );

The results are not at all the same. The ML results are ~ the same as point-by-point adding zi to the length zi number of points at the beginning of y. As for the IPP results, I don't have a clue as to what it's doing. The zi I'm using is symmetric, so it's not a matter of flipping it left-right, but obviously I'm missing something. The zi I'm using is symmetric, so it's not a matter of flipping it left-right, but obviously I'm missing something.

Any ideas on how to get IPP to work like MatLab without simpling adding the intitial conditions to the output?

Jay_Schamus

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-11-2012
07:38 AM

13 Views

IppsFIR and Initial Conditions

y = filter( b, 1, x );

and then use the IPP functions():

IppsFIRState_64f *pState;

ippsFIRInitAlloc( &pState, *b, lenb, NULL );

ippsFIR( *x, *y, lenx, pState );

I get the same results in ML and IPP.

But if I do the following in MatLab:

y = filter( b, 1, x, zi );

and the following in IPP:

IppsFIRState_64f *pState;

ippsFIRInitAlloc( &pState, *b, lenb, *zi );

ippsFIR( *x, *y, lenx, pState );

The results are not at all the same. The ML results are ~ the same as point-by-point adding zi to the length zi number of points at the beginning of y. As for the IPP results, I don't have a clue as to what it's doing. The zi I'm using is symmetric, so it's not a matter of flipping it left-right, but obviously I'm missing something. The zi I'm using is symmetric, so it's not a matter of flipping it left-right, but obviously I'm missing something.

Any ideas on how to get IPP to work like MatLab without simpling adding the intitial conditions to the output?

2 Replies

Highlighted
##

Hi,

"filter" in Matlab corresponds to IIR filter - when you use "null" delay line and a[0]=1 - it works as FIR, but when you use initialized delay line - "filter" considers it as IIR direct form 2 delay line (see description for "filter" in the manual); IPP FIR considers delay line as simple tapsLen-1 delayed source. For full correspondence with "filter" you should use IPP IIR functionality and recalculate zi (delay line) to direct form 2 as it's described in Matlab documentation (ippsIIR also uses direct form 2 delay line). Or if you need only FIR - you should use your direct form1 delay line for IPP and for Matlab you should recalculate it to the direct form2:

igorastakhov

New Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-11-2012
11:59 PM

13 Views

"filter" in Matlab corresponds to IIR filter - when you use "null" delay line and a[0]=1 - it works as FIR, but when you use initialized delay line - "filter" considers it as IIR direct form 2 delay line (see description for "filter" in the manual); IPP FIR considers delay line as simple tapsLen-1 delayed source. For full correspondence with "filter" you should use IPP IIR functionality and recalculate zi (delay line) to direct form 2 as it's described in Matlab documentation (ippsIIR also uses direct form 2 delay line). Or if you need only FIR - you should use your direct form1 delay line for IPP and for Matlab you should recalculate it to the direct form2:

for( i = 0; i < order; i++ ){

pDly* = 0; for( n = order - i; n > 0; n-- ){ pDly*

Highlighted
##

Doh!

Thanks, Igor. I didn't make the connection that of course ML is always using an IIR filter even when the denominator coefficients are just 1. Been too long since I took my filters classes.

Thanks again.

Jay_Schamus

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-12-2012
07:39 AM

13 Views

Thanks, Igor. I didn't make the connection that of course ML is always using an IIR filter even when the denominator coefficients are just 1. Been too long since I took my filters classes.

Thanks again.

For more complete information about compiler optimizations, see our Optimization Notice.