how to generate a filter code including coefficients?
13 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Meade
on 2 Mar 2017
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.
See Also
Categories
Find more on Statistics and Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!