Newbie: How to create a low pass that can be exported into c++?
Show older comments
Hi everyone,
I am a c++ developer and COMPLETELY new to matlab. I read that matlab can help me with low pass filtering a signal. my signal has a x and y int16 component and in my c++ application one can change sample rate and cutoff frequency. I have watched a tutorial and read some posts, i.e. http://www.mathworks.com/matlabcentral/answers/37975-how-to-design-an-iir-low-pass-filter-with-matlab but I am still stuck.
my goal is to have a c++ function that i can just pass my signal data to on the fly, the signal is not prerecorded. so i was thinking one could initialize a butterworth low pass with sample rate and cutoff frequency like: fdesign.lowpass('N,F3db', 3, 0.5, 2000); and then continuously run the incoming data through the filter. when the user changes the cutoff frequency the filter would be reinitialized.
i know how to create c++ code from a matlab project, but can someone point me in the right direction how the matlab functions should look like?
thanx!!
Answers (2)
Wayne King
on 28 Jul 2012
0 votes
Which MathWorks' products do you have? If you have MATLAB Coder, the Signal Processing Toolbox, and the DSP System Toolbox, you can easily write a filter design and implementation routine in MATLAB that you can port directly to C/C++ code with codegen
Martin
on 28 Jul 2012
0 votes
Categories
Find more on C Code Generation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!