Trouble about importing data using 'From File' block in simulink

4 次查看(过去 30 天)
Hi Everyone,
I've a data that is logged from my hardware. The data consists of two items. One is the 'time stamp' and the other is the 'real data'. Here, 'time stamp' represents the sample time at which the 'real data' has been sampled. The sample time is 10ms. But as you know, in the logged data, it is not exactly 10ms all the time.
Anyway, I'd like to import this data to my simulink model. So, I converted this data to store in a *.mat file such as the 1st row contains 'time stamp' data and the 2nd row contains 'real data'.
Now, using the 'From File' block, I'm loading this data to my model (I have a total of around 10,000 samples of both 'time stamp' and 'real data' each). I set the 'Sample time' parameter of 'From File' block as '0.01' and I set a value of '100' for 'Simulation stop time'.
And now, using the 'To File' block, I'm storing this data again back to a *.mat file to check how my data has been using by my model. I observe, that the data is not same as my real data. I think simulink is doing some interpolation if 'time stamp' in my input data file is not matching to the sample time of 'From File' block. But, I'd like my model to use exactly the same data as in my input file.
Is there anything that I'm doing wrong here? Also, I'm not quite sure, if I'm configuring all the parameters properly here(like 'Sample time' of 'From Block' or 'Simulation stop time' etc).Is the 'Simulation stop time' here is based on no. of samples that I've in my input data file and 'sample time' of data?
Could you please suggest your ideas on my process that I'm using now.I'm pretty new to Simulink, and I try to read many articles about this, but still not very clear about my process.
I'm using 'Fixed-step' solver with '0.001' as 'fundamental sample time' i.e. Sample time of my model is 1ms.
Thank You

采纳的回答

Kaustubha Govind
Kaustubha Govind 2012-5-14
As you mentioned, your time stamps are not exactly at 10ms all the time. What if you fudge the time-stamps of the input signal so that they are exactly 10ms apart? Does this fix the interpolation issue?
Also, you can turn on Sample Time Colors on your model to make sure that the "From File" block is indeed running at 10ms.
  3 个评论
Kaustubha Govind
Kaustubha Govind 2012-5-14
The warning is saying that you don't need ode1 because you don't have any continuous states in your model. It is sufficient to pick the FixedStepDiscrete solver which Simulink is doing for you automatically. You can switch to this solver yourself so the warning isn't displayed.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Environment Customization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by