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.

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by