What's the best approach for learning S-Function development

조회 수: 2 (최근 30일)
Paul
Paul 2011년 9월 27일
댓글: Amr AbdelAty 2014년 8월 31일
I'm coming to Simulink from an MSC simulation platform and it has become immediately obvious to me that I am going to have to develop some of my own custom S-Functions.
I have several questions that I'm hoping to get answered up front so I can hopefully "do it right the first time".
Most importantantly.... is there any good, up to date, learning materials for S-function development that start from the basics can go to the advanced? Cost of the materials is not an issue as my employer will be paying.
From my reading fo teh Matlab Help documentation it appears that C-file S-functions are the best supported. Is that an accurate assessment? Should one be learning C-file right from the beginning? Is there any benefit of one type of S-function over the other?
Any help pointing the right direction is greatly appreciated.

답변 (2개)

Kaustubha Govind
Kaustubha Govind 2011년 9월 27일
See Comparison of Custom Block Functionality for an extensive comparison of the capabilities of each type of S-function.
For learning, as Fangjun suggested, I've found the S-function documentation useful. The best way is to practice writing S-functions for simple examples. Type "sfundemos" at the MATLAB prompt to see some examples - you could try recreating some of the examples by yourself and then compare to the actual solution.

Fangjun Jiang
Fangjun Jiang 2011년 9월 27일
The S-function section of the Simulink document is sufficient for you to start writing S-function.
I prefer S-function using MATLAB .m file because it's easy to debug in MATLAB environment. But if you have to use some existing functions in C or other language, then you probably need to use that language.
And if you need to generate C code from your Simulink model later on, then it's probably better to use C for S-function.

카테고리

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