conversion from simulation time to real time
이전 댓글 표시
hello ... i have a simulink program with fixed step size (0.001),, i run the program in time (0-300) ,, and when i want to plot my results, the "time axis" is the simulation time (not the real time) ... i.e. this 300 (simulation time) equal almost 1 minutes (in real word) ... how can i convert this 300 to 60 second to make the results in real time ?
댓글 수: 1
Azzi Abdelmalek
2014년 4월 5일
You mean at the end of the simulation?
답변 (1개)
Azzi Abdelmalek
2014년 4월 5일
Look at this example
t=0:300
y=sin(0.1*t)
tn=60;
t_new=linspace(0,60,numel(t))
plot(t_new,y)
댓글 수: 9
Azzi Abdelmalek
2014년 4월 5일
I have understood you are running a Simulink model, that's why I've asked if you want to plot after simulation or during. Now what you are asking for is not clear, set the stop time to 300 then change it to 60, how? and what is your aim?
Azzi Abdelmalek
2014년 4월 5일
편집: Azzi Abdelmalek
2014년 4월 5일
If you want to make a simulation in real time, you can use a real time windows target . If you haven't this toolbox, you can use pause command
cmcm
2014년 4월 5일
Azzi Abdelmalek
2014년 4월 5일
No you can do many things with RTWT, You can control a real system. In your case, you can just make a simulation in a real time (60 s will be almost 60 s), this is possible if the calculation time doesn't exceed your step time, you can get better behaviour with simulation in external mode.
cmcm
2014년 4월 5일
Azzi Abdelmalek
2014년 4월 5일
편집: Azzi Abdelmalek
2014년 4월 5일
Azzi Abdelmalek
2014년 4월 5일
To use the external mode, you will need also, a Simulink coder
카테고리
도움말 센터 및 File Exchange에서 Event Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!