how define a variable that increment by Simulink time

5 ビュー (過去 30 日間)
Mary
Mary 2017 年 11 月 11 日
コメント済み: Mary 2017 年 11 月 11 日
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.

採用された回答

Birdman
Birdman 2017 年 11 月 11 日
編集済み: Birdman 2017 年 11 月 11 日
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 件のコメント
Mary
Mary 2017 年 11 月 11 日
Thank you so much for your help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by