Reputation: 2267
Is it possible to explicitly set the sample time of a Matlab function block in a Simulink model? If yes, how? If not, how can you change the sample time of a signal coming from a Matlab function block?
For instance, how can one make sure that the sample time of a (possibly variable-sized) signal coming out of a block will be discrete?
Upvotes: 0
Views: 2883
Reputation: 1162
Using the Matlab Function block you can Right click > Block Parameters > Sample time. Change from -1 to the sample time you want.
To make sure your simulation is using the correct sample time you can select the double arrows in the left panel and click on "Colors". Then, back in the double arrows, select "Sample Time Legend". Now, the different colors represents different rates in which Simulink is running.
Upvotes: 0
Reputation: 13876
Your best option is to use the Rate Transition block.
Also have a look at the Convert Signals Between Continuous Time and Discrete Time example to see how it's being used in practice.
Upvotes: 0