Pregunta

What is the block that I can use for the creating a custom s-function in simulink?

I want to use C code using S-Function.. I know that there are functions that I have to define but I don't know how to reach it or which code to start with exactly..

Note: I am totally new to matlab and simulink..

¿Fue útil?

Solución

Check out the S-function Builder block from Simulink's library (in Simulink->User Defined Functions). You can set number of states, inputs, outputs and also add code for calculating the derivatives + outputs. When you press Build it generates C code and you can start with that as a template. Or you could use the S-function Builder interface for writing all your code.

Edit: Matlab also has a built-in template that you can access:

edit([matlabroot,'/simulink/src/sfuntmpl_basic.c']);

Otros consejos

Did you check the MATLAB documentation on this? It is usually pretty complete, once you find the right page to read.

For s-functions there e.g. is

http://www.mathworks.de/de/help/simulink/sfg/how-to-implement-s-functions.html

which includes links to example s-functions you can find in your matlab-installation.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top