Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
18 years ago

Filter Design using DSP Builder

Hi,

I tried to implement a filter design with the following equation:

y(n) = -0.5y(n-2) - 0.25y(n-3) + x(n)

using DSP builder which i attached the model file with this post. and when i simulate it i get the following result:

yout =

0

1.0000

0

0

0

0

-0.5000

-0.2500

0

0

0

0.2500

0.2500

0

0

0

-0.2500

-0.2500

-0.2500

0

0

0

0

0

0

0

0

0

0

0

0

Then when i check in matlab i get the following result:

>>num = [1];

>> den = [1 0 0.5 0.25];

>> [num,den] = eqtflength(num,den);

>> h = impz(num, den, 21)

h =

1.0000

0

-0.5000

-0.2500

0.2500

0.2500

-0.0625

-0.1875

-0.0313

0.1094

0.0625

-0.0469

-0.0586

0.0078

0.0410

0.0107

-0.0225

-0.0156

0.0085

0.0134

-0.0004

so obviously my filter design using dsp builder is not correct. but i dont know where gone wrong. any advice? could it be the pulse generator's setting?

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I don't have time to access your model, but perhaps you are not using enough resolution... Try increasing your resolution of your filter. Keep in mind that MATLAB's filter function is implemented in floating point and the filter you implemented in DSP Builder is in fixed point notation. You might need to increase your filter and your input resolution to get a comparable results.