how to generate a filter code including coefficients?
11 次查看(过去 30 天)
显示 更早的评论
I would like to generate custom Matlab codes with Zero phase filter (filtfilt) like generateFilteringCode(FC). How can I do it? With generateFilteringCode(FC), a matlab function is generated with the filter coefficients. I would like to generate or program a matlab function for Zero phase filter, however, I have no idea how to including into the filter coefficients like a function generated from generateFilteringCode(FC). Any advice? Many thanks
Qingshan
0 个评论
回答(1 个)
Meade
2017-3-2
Qingshan,
Based on you question, it seems like you really have 2 needs:
#1) Calculate the filter coefficients for a particular scenario & filter type (e.g. fir, iir, etc etc)
#2) Apply the coefficients to a signal such that you will see no phase-shift in the output.
For question 1, check out designfilt. This will help you calculate the necessary coefficients. I have also written a wrapper function for the old SAE-J211 low pass filters . It might give you an idea of how to do it.
For question 2, once you have your coefficients, you can use filtfilt if you have the "Signal Processing Toolbox". If you do not, check out the excellent function FilterM by Jan Simon. It works with lots for lots of applications and doesn't need any toolboxes.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Linear Algebra 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!