how define a variable that increment by Simulink time

3 vues (au cours des 30 derniers jours)
Mary
Mary le 11 Nov 2017
Commenté : Mary le 11 Nov 2017
I am using Simulink in my system implementation. I have a matrix of size(1,500)as an input and need to output one row each time. As you can see in the attachment, How can I have one row of my .mat file per time.

Réponse acceptée

Birdman
Birdman le 11 Nov 2017
Modifié(e) : Birdman le 11 Nov 2017
In this type of situations, what you need to do is to use a mat file which has a size of nx2, in this case n=500. The first column should consist of time vector of simulation time and it should be same size with your second column. The second column should contain your data. I also suggest you to work in discrete time where you input data from workspace.
For instance, since your data has a size of 500, if your simulation time is 10 seconds, your sampling(Step size) should be 10/500= 0.02. By this, you can form your first column(time vector) like
0:0.02:10
Note that this will form 501x1 column, so make sure that your second column also contains 501 elements.
To sum up, create a 501x2 array which contains
array=[time data];
Then give this as input from From Workspace block. Hope this is helpful for you.
  1 commentaire
Mary
Mary le 11 Nov 2017
Thank you so much for your help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Simulink dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by