Help implementing a digital filter
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Vieniava
2011 年 1 月 27 日
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
3 件のコメント
参考
カテゴリ
Help Center および File Exchange で Analog Filters についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!