How can I use single float with filtfilt in matlab coder?
조회 수: 3 (최근 30일)
이전 댓글 표시
I use matlab coder (matlab version:R2017a) to compile matlab code to C code .And I want to use single floating-point number.While I have used filtfilt function in matlab code. Then I got an error it said filtfilt only takes double floating-point number.I have tried using single() to convert parameters in filtfilt but still failed.Is there anyone can help me?Thanks.
댓글 수: 0
답변 (1개)
Jan
2017년 6월 19일
편집: Jan
2017년 6월 19일
Either convert the signal using double(), or use FEX: FilterM, which accepts single values, but accumulate the internal filter state as doubles to increase the accuracy or the output.
댓글 수: 4
Jan
2017년 7월 4일
While filter works on single also, filtfilt accepts doubles only (at least in some Matlab versions). You can either include the C-Mex FilterX and FiltFiltM.m (see https://www.mathworks.com/matlabcentral/answers/48620-generating-c-c-code-from-m-function-include-mex-file), or modify the builtin filtfilt.m function to accept singles also. I still do not see, where the problem is.
참고 항목
카테고리
Help Center 및 File Exchange에서 Statistics and Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!