MATLAB Answers

How can explain the relation between mdlDerivatives output and mdlOutputs in S-function simulink

12 views (last 30 days)
Mary
Mary on 12 Nov 2017
Answered: Nick Choi on 14 Nov 2017
I am new in Simulink and have a model which is used the S-function. I can not understand how the output of the mdlDerivatives relates to the outputs of the mdlOutputs? In another word, If I want to write a mfile(without using Simulink) what are the states and what are the outputs? I want to write a mfile and find ddq, dq and q but do not get how states in these two parts make the output?(file attached)

Answers (1)

Nick Choi
Nick Choi on 14 Nov 2017
As described in this documentation link, 'mdlDerivatives' is an optional method that can be used to compute the derivatives for the continuous states of an S-function at each time step:
'mdlOutputs' is a required method that computes the outputs for an S-function block at each time step
Regarding how the sections of an S-function relate to each other, the following documentation page provides some useful information on how S-functions work and it also describes how the inputs, outputs and states of a block are related:

Community Treasure Hunt

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

Start Hunting!