Help implementing a digital filter
조회 수: 6 (최근 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!