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

5 ビュー (過去 30 日間)
Martin
Martin 2012 年 7 月 28 日
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 Center および File ExchangeC Code Generation についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by