S-Function Builder Simple Integrator Implementation

조회 수: 4 (최근 30일)
Nima Forghani
Nima Forghani 2012년 7월 11일
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.
  댓글 수: 1
Nima Forghani
Nima Forghani 2012년 7월 11일
Thank you Kaustubha!
You're always helpful! :-)
Nima

댓글을 달려면 로그인하십시오.

추가 답변 (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