Guy and Seth on Simulink

Results for: S-functions

A Free Dialog for your MATLAB System Block 2

Posted by Guy Rouleau,

A Free Dialog for your MATLAB System Block Today I am happy to welcome guest blogger Jacob Halbrooks to describe some nice capabilities of the MATLAB System block dialog. The MATLAB System block is new in R2013b and allows you to easily use a System object in Simulink. Guy introduced System objects and the MATLAB System block, and Revathi... read more >>

Simulink and MATLAB objects 4

Posted by Guy Rouleau,

Simulink and MATLAB objects Recently, I spoke with a user who needed to interface a Simulink model with an external flight simulator implemented as java classes. He was able to exchange data with his simulator at the MATLAB prompt, but was not sure how to make that happen in Simulink. Here is what I proposed. The... read more >>

Problems with your S-Functions… Try this Diagnostic! 1

Posted by Guy Rouleau,

Problems with your S-Functions… Try this Diagnostic! Ahhh... C Mex S-function... If you ever tried creating a C Mex S-function and were a little rusty on your C programming, you might have experienced strange behavior or event MATLAB crashes. This is possible... C Mex S-Functions let you do almost anything you can think of, including shooting yourself... read more >>

Methods of the MATLAB System Block

Posted by Guy Rouleau,

Methods of the MATLAB System Block In the last post on MATLAB System block, I tried to provide a basic introduction to System Objects in MATLAB and Simulink environments. At the end, I finished with a quick example illustrating that System objects offer several methods to set up the properties of states and output signals of... read more >>

A Tweeting S-Function for the Raspberry Pi 7

Posted by Guy Rouleau,

A Tweeting S-Function for the Raspberry Pi I recently bought a Raspberry Pi. After trying a few of the demos included with the Simulink support package for Raspberry Pi, I began thinking about what I could do next. Just for fun, I thought... could I get a Simulink model deployed on the Raspberry Pi to send Tweets? Sending Tweets... read more >>

Creating Driver Blocks for Arduino, Lego, and other targets 2

Posted by Guy Rouleau,

Creating Driver Blocks for Arduino, Lego, and other targets As you may know, it is easy to run Simulink models on a set of supported target hardware. This has been possible since R2012a. Even if we add more targets and support more features for each target with every new release, it is still possible that you will need a driver... read more >>

Debugging C/C++ S-Functions 2

Posted by Guy Rouleau,

Debugging C/C++ S-Functions If you are going to work with C or C++ S-Functions, you will probably need to do some debugging. My advice is: Don't go with the printf debugging approach. I did that for too long and now I realize it was a waste of my time. Once you discover how... read more >>

Creating Your Own Block With Continuous States (MATLAB S-Function) 5

Posted by Guy Rouleau,

Creating Your Own Block With Continuous States (MATLAB S-Function) In a previous post, I showed an example of a MATLAB S-Function with a discrete state This week, we continue in the same direction and implement an S-Function with a continuous state. Continuous States To begin, let's go back to the question posted on MATLAB Answers by K E: What are continuous and discrete... read more >>

Writing your own block with discrete states (MATLAB S-Function) 5

Posted by Guy Rouleau,

Writing your own block with discrete states (MATLAB S-Function) A few weeks ago, I noticed the following question on MATLAB Answers by K E: What are continuous and discrete states in Simulink? In my opinion, the best way to understand how states work in Simulink is by implementing an S-Function. So this week we will see how to create a MATLAB... read more >>

How to make your own blocks with code! (Introduction to S-Functions) 8

Posted by Guy Rouleau,

How to make your own blocks with code! (Introduction to S-Functions) I have to admit... before joining MathWorks, I was afraid of S-Functions. Now this makes me laugh, because I know that writing an S-Function is very powerful and not that complicated. In my opinion, understanding S-Functions is the best way to understand how Simulink works. When looking at the previous posts on this... read more >>

These postings are the author's and don't necessarily represent the opinions of MathWorks.