Creating Bessel Filter

Hi everyone,

I am attempting to filter my data using a digital 8-pole bessel filter. I can easily create the numerator and denominator constants via MATLAB for the filter I would like to use (it does what I want in MATLAB) and I am trying to extend this to IGOR. I am using the FilterIIR and feeding it the coefficients. I read the help and its nuance with having having a as the numerator instead of b. I tried both ways and my filter did not work. Any advice would be appreciated!

Thanks,
Mike
We need more information about what you're attempting.

1) the constants,
2) and how they're used in MATLAB,
3) How you're calling the FilterIIR command,
4) A frequency plot would be helpful, too.

Also, have you tried entering them in the Design IIR Filter dialog?

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
Hi Jim,

1) the constants
These are the constants how I am loading them in to IGOR. I'm using the convention as laid out in the help:
"Coefficients derived using this notation need their denominator coefficients sign-reversed before putting them into rows 1 through N of column 1 (the second column), and the "missing" nondelayed denominator coefficient of 1.0 placed in row 0, column 1."

Make/O/N=(9,2) coefsWaveName
coefsWaveName[0][0]=5.596263896734399e-09
coefsWaveName[1][0]=4.477011916748097e-08
coefsWaveName[2][0]=1.566953606868538e-07
coefsWaveName[3][0]=3.133908634822546e-07
coefsWaveName[4][0]=3.917383750717818e-07
coefsWaveName[5][0]=3.133908776931094e-07
coefsWaveName[6][0]=1.566953429232854e-07
coefsWaveName[7][0]=4.477012760517596e-08
coefsWaveName[8][0]=5.596262120377560e-09
coefsWaveName[0][1]=1
coefsWaveName[1][1]=6.8517
coefsWaveName[2][1]=-20.593
coefsWaveName[3][1]=35.4577
coefsWaveName[4][1]=-38.2516
coefsWaveName[5][1]=26.4730
coefsWaveName[6][1]=-11.4773
coefsWaveName[7][1]=2.8497
coefsWaveName[8][1]=-0.3102

2) and how they're used in MATLAB
In MATLAB:
[b,a]=besself(8,20000);
[b1,a1]=bilinear(b,a,100000);
data = filter(b1,a1,data);

3) How you're calling the FilterIIR command
FilterIIR/COEF=coefsWaveName WaveTable

4) A frequency plot would be helpful, too.
Attached

Also, have you tried entering them in the Design IIR Filter dialog?
I have not, I will see if I can figure it out, thanks!
frequency_plot.jpg (19.75 KB)
MikeCU wrote:
Hi Jim,

1) the constants
These are the constants how I am loading them in to IGOR. I'm using the convention as laid out in the help:
"Coefficients derived using this notation need their denominator coefficients sign-reversed before putting them into rows 1 through N of column 1 (the second column), and the "missing" nondelayed denominator coefficient of 1.0 placed in row 0, column 1."
...
2) and how they're used in MATLAB
In MATLAB:
[b,a]=besself(8,20000);
[b1,a1]=bilinear(b,a,100000);
data = filter(b1,a1,data);


Reading the Matlab description of the coefficients created by their besself and bilinear Signal Processing Toolbox functions:

http://www.mathworks.com/access/helpdesk/help/toolbox/signal/besself.ht…

http://www.mathworks.com/access/helpdesk/help/toolbox/signal/bilinear.h…

indicates that they're using the exact same coefficient organization as Igor EXCEPT they are using REVERSED namings of numerators and denominators. (In all fairness, their code predates ours, we just read different books.)

In Matlab, b contains the numerators in decreasing order of s (increasing order of z-1), and a contains the denominators (all of them, including the leading a0=1):

          B(z)
H(z) =    --- (Matlab)
          A(z)


In Igor, the numerators are called a and the denominators are called b.
          A(z)
H(z) =    --- (Igor)
          B(z)


So you should be able to plug their b[1..n+1] numerator coefficients into the first column of the /COEF wave in rows 0..n, and their a[1..n+1] denominators into the second column and get the same filtering result.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
Wow, I lost track of this, but just now getting back to programming it. Anyways, Jim, thank you for your response, but I was already aware of that nuance as mentioned in my first post. I tried both ways to be sure but still unable to filter correctly in IGOR. I'm still having to export to MATLAB and use their filter function!
MikeCU wrote:
Wow, I lost track of this, but just now getting back to programming it. Anyways, Jim, thank you for your response, but I was already aware of that nuance as mentioned in my first post. I tried both ways to be sure but still unable to filter correctly in IGOR. I'm still having to export to MATLAB and use their filter function!


Post to indicate what the numerators are and what the denominators are, and I'll give it another try.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
Oh, and Igor wants the bilinear version of the coefficients (a1, b1)

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
Hi Jim,

My 2nd post contains what I am loading in IGOR and what I use in MATLAB. I double checked to make sure that what I posted fits the numerator/denominator switch from MATLAB to IGOR and my "b1" bilinear coefficients are loaded in to the first column and "a1" loaded in to the second column as you have described.

Thanks!
Mike