Newbie: How to create a low pass that can be exported into c++?

5 次查看(过去 30 天)
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!!

回答(2 个)

Wayne King
Wayne King 2012-7-28
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
Martin 2012-7-28
i have Matlab R2011a with the coder, the signal processing toolbox and the dsp system toolbox. and i will read some more tutorials on how to combine them. could you provide some sample code or step-by-step instructions that i can start with? thanx!

类别

Help CenterFile Exchange 中查找有关 C Code Generation 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by