how define a variable that increment by Simulink time

2 visualizaciones (últimos 30 días)
Mary
Mary el 11 de Nov. de 2017
Comentada: Mary el 11 de Nov. de 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.

Respuesta aceptada

Birdman
Birdman el 11 de Nov. de 2017
Editada: Birdman el 11 de Nov. de 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.

Más respuestas (0)

Categorías

Más información sobre Simulink en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by