S-Function Builder Simple Integrator Implementation

4 次查看(过去 30 天)
Hello,
I'm pretty new in the Matlab S-Function world and I'm struggling with implementing a simple integrator S-Function using the S-Function Builder Block in Simulink.
I'm using the S-Function builder block as it easily allows me to control my input and output port dimension size under the Port Parameter Properties.
The single continuous time integrator I'm trying to model is the following:
xdot = u
y = x
Unfortunately the term I'm writing inside the "Continuous Derivative" tab doesn't represent the derivative state and the final compiled S-Function doesn't act as an integrator. The term I'm writing in the Output and Continuous Derivative Tabs are the following:
y0[0] = u0[0]; (u0 is the port 1 input state and y0 is the output port variable)
dx[0] = u0[0]; (Derivative Tab code)
I'd appreciate it if you could let me know what I'm doing wrong that this S-Function only acts as a direct feedthrough.
Thanks in advance. Nima

采纳的回答

Kaustubha Govind
Kaustubha Govind 2012-7-11
Your Derivatives tab looks right, but I think you need this in your Outputs tab:
y0[0] = xC[0];
Note that this is what "y=x" corresponds to.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by