Simulink S-function builder reading inputs

1 回表示 (過去 30 日間)
Stepan Podhorsky
Stepan Podhorsky 2019 年 9 月 8 日
回答済み: Fangjun Jiang 2019 年 9 月 9 日
Hello all,
I have just started to learn how to implement the S-functions via
the Simulink S-function builder. I have been attempting to model
a discrete system with two 1-D inputs (act and ref) and one
1-D output (u). My C language code for the outputs calculation is
following
double ref;
double act;
double e;
e = ref - act;
u[0] = e;
The building process is successful but whenever I start the simulation
process there is zero at the S-function block output despite the fact
that the ref input is non-zero.
I have also tried a different version of C code:
double ref;
double act;
double e;
e = ref[0] - act[0];
u[0] = e;
But in that case I was not able to build the code.
Can anybody tell me what I have been doing wrong?

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2019 年 9 月 9 日
"u" is usually referred as inputs, "y" is usually referred as outputs.
You need to go through the S-Function Builder Dialog Box to fill the info and copy&paste your C code.

カテゴリ

Help Center および File ExchangeAuthor Blocks Using S-Function Builder についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by