define 1D array in simulink
显示 更早的评论
I am trying to define a time array to use as an input to an equation in simulink. I tried importing from the workspace but apparently the array needs to have at least two columns. I read that it's possible to define an array in a constant block but my array is going to be very large. any suggestions?
回答(1 个)
Sebastian Castro
2015-4-9
编辑:Sebastian Castro
2015-4-9
0 个投票
In Simulink, your array should have at least 2 columns -- the first column is always the time, and all subsequent columns are the signal values at the times in the first column.
When dealing with time, you can:
- Set the start and stop times, as well as time steps, in the model configuration parameters.
- Use a "Clock" block from Simulink > Sources if you need to use the simulation time explicitly in your calculations.
- (I guess) if this model will be part of a bigger hierarchy, you want to keep that input port there but use the time as a unit test signal. If so, you could just repeat the time vector as two columns, so that the signal is exactly the time value at all times.
Maybe the above will solve your problem. Or, maybe you need a time vector for something else and I am misunderstanding your question. Why do you want a vector of just time valus?
- Sebastian
类别
在 帮助中心 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!