How to use unsupported function when using Coder

Hi,
I wanna use fdesign.audioweighting('WT','ITUT041',..) and design() function. However both of them are not supported by Matlab coder.
How can i create C .dll with these function in 2023a?

回答 (1 件)

Kanishk
Kanishk 2024 年 8 月 9 日

0 投票

Hi @BERKAY,
Yes, ‘fdesign.audioweightingis not supported by MATLAB coder for code generation. But you can follow a hybrid approach. This involves designing the filter in MATLAB, extracting the filter coefficients, and then using these coefficients in a MATLAB function that can be converted to C code.
d = fdesign.audioweighting('WT', 'ITUT041');
Hd = design(d, 'butter');
[b, a] = tf(Hd);
save('filterCoefficients.mat', 'b', 'a');
You can use these saved variables with ‘filter’ function which is supported by MATLAB coder for code generation.
filter(b, a, x);
To load variables from MAT file during compile time in MATLAB Coder see coder.load: https://www.mathworks.com/help/simulink/slref/coder.load.html
Also to learn more about ‘filter’ function you can refer: https://www.mathworks.com/help/releases/R2024a/matlab/ref/filter.html

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

製品

リリース

R2023a

質問済み:

2023 年 5 月 17 日

回答済み:

2024 年 8 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by