Simulink S-function builder reading inputs
1 view (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Fangjun Jiang
on 9 Sep 2019
"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.
0 Comments
See Also
Categories
Find more on Configure Block Features for MATLAB S-Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!