Specifying time frames for Simulink simulation, using colon operator, gives invalid data

1 Ansicht (letzte 30 Tage)
I am using the below command:
sim(test.settings.model, [time(1) time(end)], [], input_struct);
Where input_struct is defined via:
input_struct.time
input_struct.signals(j).label
input_struct.signals(j).dataType
input_struct.signals(j).dimensions
If the "inports" have interpolation on, then "time" variable does not math with the following format of specified time frames:
t1 = [0:1/80:11/80]' % Do not work even though I provide in double format
I am providing 12 frames of time data which must align perfectly with time variable in input_struct, to prevent interpolation.
I can fix the problem by specifying time via:
t2 = 0.0125*[0:11]'
Using format long and taking the difference between these 2 approaches (t1-t2) frame 10 is not close enough to 0.
If the inports have interpolation off and t1 format is used, then Sim is holding last value and thus not using my exact input (I provided in the input_struct signals data).
Bottom line, the first method (t1) of specifying time is not accurate enough. Please expalin behavior?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 16 Jul. 2021
Please refer to the following documentation page that explains why one format works and the other does not:

Weitere Antworten (0)

Kategorien

Mehr zu Simulink finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by