simulink user defined matlab function outputs zero irrespective of input
古いコメントを表示
I am using simulink user defined block to realise a difference equation. The function is defined as shown below.
function y = fcn(u)
a = [1 -2 1]; % left hand side of difference equation
b = [0 1 2]; % right hand side of difference equation
y=filter(b,a,u);
When I use this block independenly with some array as input, I am able to get the expected values. But when I use this block in another design, the output is always zero though the input is changing. Any suggestions on how to debug this ?
4 件のコメント
Ameer Hamza
2020 年 9 月 23 日
Try adding a breakpoint inside the function to see whether the input is non-zero or not.
Nithin Ravani Nanjundaswamy
2020 年 9 月 23 日
Ameer Hamza
2020 年 9 月 23 日
and what is the value of y if you execute code line by line during breakpoint?
Nithin Ravani Nanjundaswamy
2020 年 9 月 23 日
回答 (1 件)
Jalaj Gambhir
2020 年 10 月 1 日
0 投票
カテゴリ
ヘルプ センター および File Exchange で Simulink についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!