Can the filtfilt function be used in the simulink block matlab function?

8 ビュー (過去 30 日間)
Brecht Vermeulen
Brecht Vermeulen 2018 年 7 月 23 日
コメント済み: Brecht Vermeulen 2018 年 7 月 23 日
Goodafternoon,
I wanted to use a non-causal filter on a array of datapoints in my Simulink model. Therefore I implemented the filtfilt function in a matlab function block. However, I get the following error:
Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs.
Component:MATLAB Function | Category:Coder error
Index exceeds array bounds.
Function 'MATLAB Function' (#737.23.38), line 3, column 3:
"filtfilt(1,2,u)"
Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
What could be the problem here? If I use 'filter' it seems to work fine. I included a simple model in the attachment.
Kind regards,
Brecht
  2 件のコメント
Ryan Takatsuka
Ryan Takatsuka 2018 年 7 月 23 日
It looks like a and b cannot have the same length in the Simulink filtfilt() call for some reason. If you design a filter where a and b are different lengths, it seems to run:
filtfilt([1,1], 2, u)
Brecht Vermeulen
Brecht Vermeulen 2018 年 7 月 23 日
Hi Ryan,
Thank you, indeed, it seems to run with the length of b > a. No idea why this is a problem though. But at least it's a workaround. I'll design a filter of this shape.
Kr brecht

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMeasurements and Statistics についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by