Help implementing a digital filter
Afficher commentaires plus anciens
I'm trying to implement a digital filter. I have the coefficients. I make the calculation in a for-loop and it's not working. The results are aberrant = 10^307.
The strange thing is that when I use the BUTTER function and use the returned coefficients, everything works correctly. So, the algorithm is correct.
If I just take the coefficients returned by butter() from workspace and use them in another *.m file as normal variables, it's not working. Why?
If I want to calculate the coefficients and check them in this way, why I cannot do it?
2 commentaires
Todd Flanagan
le 21 Jan 2011
Hi. Posting a code snippet would be very helpful.
Monica
le 25 Jan 2011
Réponses (1)
Vieniava
le 27 Jan 2011
The problem is that those lines
b = 1.0e-011 *[0.0668 0.3342 0.6683 0.6683 0.3342 0.0668]
a =[ 1.0000 -4.9762 9.9050 -9.8579 4.9055 -0.9765]
are only approximation (for display purpose) of values computed by butter() .
To store your coefficients you should after
[b,a] = butter(5,fc_normal,'low')
write this
save('MyFilter','a','b')
When you need restore those values in another m-file just load via
load MyFilter
Catégories
En savoir plus sur Analog Filters dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!