How can I use simulink without time simulation?
13 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
This is my very first time posting here. Let's say that I'm a "rookie" eager to learn more and more from Matlab and Simulink. I will be starting soon to start some simulink tasks at my job (with help from some guy who knows about Matlab) but I'm developing (or trying) to do some things on my own just to progress.
I want to build a simulink model which has to read the data from an Excel file. The data in the Excel comes from a data acquisition system which has logged:
- 1 column for air pressure
- 1 column with time (1 read every 1 milisecond -1kHz-)
The purpose of my model is to read the air pressure value and integrate it but it has to do it according to the corresponding recording time in the cell of the adjacent column. I'm stuck at understanding how simulink performs the simulations because I want the model to introduce the air pressure value read every 1 milisecond as recorded in the data acquisition system but I'm forced to set a simulation time in simulink which doesn't match my data.
How can I tell Simulink "hey, this is my air pressure at 1 milisecond, integrate it, then, this is my air pressure at 2 miliseconds and integrate it" and so on?
I hope my question is clear
0 个评论
采纳的回答
Jim Riggs
2019-2-19
编辑:Jim Riggs
2019-2-19
If your timestep is constant, you can set your model to run at a fixed timestep. You can even specify a non-zero start time if you want to. To do this, click on the model configuration parameters button, then on the "solver" tab, set the solver type to "fixed-step". Then you can specify the time step under "additional settings".
A second approach is to build yourself a simple tick counter like so:
On each pass of the simulation, this counter will increment by one (no matter what the time step is). You can use this counter as an index to do a table look-up on your data.
1 个评论
Jim Riggs
2019-2-19
Note that you can turn the tick counter into your own fixed-step clock by multiplying the tick count by the time step.
更多回答(3 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!