# some suggestions on my octave-band spectrogram analysis in fixed point DSP implementation

Started by August 17, 2006
```i am designing one 1/3 octave band spectrogram analysis
I use multirate filter bank to realize that spectrogram. It goes this
way
1)
first, from the biggest frequency value, I use three IIR bandpass
filter, then
calculate the std value.
2)
Then decimate the input by 2 through(one 30 order FIR filter, then
resampling the input), then use the same three coffeicents to calculate
the successive three band,

3)   then repeat the step 2) til the lowest frequency.
there is 45 channels (one channel one ceter freuquency)

I got the right result throught MATLAB

But i got some different result from the fixed point DSP
implementation.
The problem is :
From the highest frequency , the channel NO.45 to the channel No
15, the result from DSP is almost the same as that from MATLAB
calculation, But within the low frequency,  some value from DSP
implemtation will be larger than that from Matlab.

Is some there met the same problem when do the implemtation of the
multirate fiter using fixed point DSP?

Since you know, when we do the multirate filter, we usually use the
same IIR bandpass filter coeffiecients at the high frequency, then
decimate by 2 ,then, the same IIR bandpass filter for the successive
band. It seems we will met the problem at the low frequency if we use
fixed point dsp.

hope I make you understand my problem, thanks.

```
```
Simon wrote:

> Is some there met the same problem when do the implemtation of the
> multirate fiter using fixed point DSP?
>
> Since you know, when we do the multirate filter, we usually use the
> same IIR bandpass filter coeffiecients at the high frequency, then
> decimate by 2 ,then, the same IIR bandpass filter for the successive
> band. It seems we will met the problem at the low frequency if we use
> fixed point dsp.

The IIR filters are known to have problems due to the limited arithmetic
precision. For the biquad, the loss of accuracy can be coarsely
estimated as (Fcutoff/Fsamplerate)^2, so the effect is particularly
severe at low frequencies. I believe this is what you see.

DSP and Mixed Signal Design Consultant

http://www.abvolt.com
```
```thanks, Vladimir Vassilevsky
then how to improve the performance at low frequency when we design
the multirate filter using the same coeffiecients for the high
frequency?  re-design the coeffiecients while not through the
decimatation for the low frequency band?

```
```
Simon wrote:
>  then how to improve the performance at low frequency when we design
> the multirate filter using the same coeffiecients for the high
> frequency?  re-design the coeffiecients while not through the
> decimatation for the low frequency band?
>

Simon,

First, let me know of what are you trying to accomplish. The questions
"How" and "Why" are coming after that.

DSP and Mixed Signal Design Consultant

http://www.abvolt.com

```
```Well, i am aiming to design a 1/3 octave band spctrogram for vibration
analysis to find the  perifodic fault of the mechanical gearbox.   the
target frequency range is from 0.7HZ to 325HZ.

I use the digital 1/3 octave bandpass filter banks to achieve my goal.

First, I did it in MATLAB.
the algorithm goes like this way,

first, i use Tms320LF2407 DSP board to sampling the data, with the
sampling frequency is 775HZ. then

1) DC removal
2) respectively calculate the coefficients of the 4 order IIR bandpss
filter  for
first three center frequency.   let's say one center frequency
stands for one channel
we start from the biggest frequency that is 325 hz.
and the first three coefficients bank is [B_high,A_high],
[B_center,A_center], [B_low,A_low].
[B_high,A_high] =oct3design(Fc,Fs, 4);
y_output=filter(B_high,A_high,x_input);
P(45)=std(y_output);

[B_center,A_center] =oct3design(Fc,Fs, 4);
y_output=filter(B_center,A_center,x_input);
P(44)=std(y_output);

[B_low,A_low] =oct3design(Fc,Fs, 4);
y_output=filter(B_low,A_low,x_input);
P(43)=std(y_output);

thus ,calculate the first P(45), P(44),P(43) ,

3) decimate the input by the factor of 2,that is
first there is one 30 order FIR lowpass filter, then
resample the input at the interval of 2.
then, repeat the step 2), while the center frequency is decreasing ,
the sampling rate is decreasing by 2, (multirate filter, decimate), but
the coefficients  [B_high,A_high], [B_center,A_center], [B_low,A_low]
is the same.

x_input=decimate(x_input,2);
y_output=filter(B_high,A_high,x_input)
;
p(i)=std(y_output);

4)  repeat step 3) till calculate P(1),

thus, bar(P);  we can get the spectrum.

The problem is :

I get the right result from MATLAB, the value from P(45) to
P(1) is right in MATLAB.

But after the implementation inside the fixed point dsp TMS320LF2407
,
I found P(45) to P(15), the result is almost the same as that from
MATLAB,but from
P(14) to P(1), I found that some of the result from DSP is bigger than
that from MATLAB.

So, I thought the calculation may lost the resolution for the low
frequency after serval downsamping by 2.

And I want to know how to resolve this problem. Should I change the
coefficients after P(14), since after serval times decimate by 2, the
value of the input is gradually decrease to near zero, i thought the
problem is because these value. In matlab, the resolution is enough,
but for the fixed point DSP, it is hard to calculate the IIR bandpass
filter , when the input is near zero.

hope you understand me.  how to resolve this problem, i want to get the
same result of P, not the high frequency ,but the low frequency. thanks

```
```Simon wrote:
>> hope you understand me.  how to resolve this problem, i want to get the
> same result of P, not the high frequency ,but the low frequency. thanks

not only the high frequency channel, but the low frequency channel

```
```good news,

I have solved this problem.

It was due to some stupid mistake.

thanks anyway!

```