필터 지우기
필터 지우기

In Simulink, how can we assign the simulation time displayed on the top, as a variable ?

조회 수: 3 (최근 30일)
I am running a simulation model in Simulink. How can we assign the simulation time displayed on the top, as a variable ? How can we run the simulation from 0 to 5 sec, with time interval after every 0.05 sec (thus creating a running window after every 0.05 sec time step, while simulating the model and feeding the data to the matlab function block to get the desired output), by assigning the simulation time as a variable ?

답변 (1개)

VINAYAK LUHA
VINAYAK LUHA 2023년 9월 15일
Hi Siddhath,
It is my understanding that you wish to know to run a Simulink model with variable stop times and timesteps.
Here’s a workaround using the “sim” command -
modelName = 'modelName';
for t = 0:1:5
simOut = sim(modelName, 'StopTime', num2str(t), 'FixedStep', num2str(0.05));
end
The above code runs the Simulink model with stop time increasing every 1 second and with “fixed” step size of 0.05 seconds.
Explore the “sim” function documentation for more details, Here's the link https://in.mathworks.com/help/simulink/slref/sim.html
Hope this helps!
Regards,
Vinayak Luha

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by