discrete time simulations sampling rate question

2 次查看(过去 30 天)
Hello,
I was hoping to get some help regarding inputting discrete time signals into Simulink. I've attached the structure used to input the signal and the simple model I used to see if the signal is being input properly.
I've left the .time structure variable empty as recommended in documentation Load Data to Test a Discrete Algorithm.
The signal it self was sampled every 5 seconds.
What I don't really understand is how to properly configure the solver for discrete simulations. Following Recommended Settings for Discrete Simulattions I set the step size as Auto and it doesn't work. When I choose a step size of 0.05 the signal is displayed but what I want to know is why if I choose 5 seconds as step size which is the sample time of the signal why that doesn't work also and the step size has to be so small.
Any help much appreciated.
Thanks!

采纳的回答

Siriniharika Katukam
Hi
The output for step size of 5 seconds and 0.005 seconds are the same. The only difference is that there should be enough simulation time to accomodate the whole simulation data given. For 0.005 seconds of step size, 60-80 seconds of stop time is sufficient, but for a step size of 5 seconds, a stop time of 5*20000 (20000 samples of data given) seconds is necessary for the entire signal to be shown up in the scope block. So, try changing the stop time to 100000 seconds in case of 5 second stepsize.
Hope it helps!

更多回答(2 个)

Siriniharika Katukam
Hi
There is a difference between the sample time of signal and the step size you set for Simulink solver.
Step size determines the time steps when the computation happens. Signal sample time is the time step at which the signal is sampled
Moreover, the sample time of signal is not mentioned anywhere in your data.

Maja Gajic
Maja Gajic 2019-10-30
Hello,
Thanks very much for taking the time to reply. I understand the difference between step time and sample time but if you are computing the solution every 5 seconds and the signal is captured every 5 seconds shouldn't this reproduce the original signal?
Yes you correctly pointed out that no where in the data is the sample time, that is because I was following this suggestion for importing data to test a discrete algorithm (I am testing a discrete moving average filter):
This is why I thought following the above approach and choosing a step time of 5 seconds would work to reproduce the signal but I have to reduce the step size around < 0.01 and what I get is the attached figures.
Any help to understand this is appreciated. Especially as I have to model an energy accumulator and really need to understand what is happening with the discrete time.
Many thanks,

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by