Plotting outputs at certain simulation time

조회 수: 14 (최근 30일)
Vinay Srinivasan
Vinay Srinivasan 2020년 10월 7일
댓글: Vinay Srinivasan 2020년 10월 10일
Hello All
I have run a simulink model and there are various number of outputs. I have to plot certain outputs with respect to time at certain simulation times. For ex; Plot time vs current between 0.25 to 0.5 seconds .May I please know how to do it ?
Thanks in advance
Regards
Vinay

채택된 답변

Jon
Jon 2020년 10월 7일
편집: Jon 2020년 10월 7일
The exact details depend upon what format you are using to save your Simulink output. It can be saved as a Simulink dataset, an array, structure with time etc. please see https://www.mathworks.com/help/simulink/ug/data-format-for-logged-simulation-data.html#bur96_r
Let's say you output your data as a SimulationOutput dataset, this is the default.
In this case after you run your simulation you should see a variable named out in your workspace.
To plot, for example, the output assigned to the second outport in the root level of your Simulink over the time range 0.25 to 0.5, you would use:
plot(out.yout{2}.Values.Time,out.yout{2}.Values.Data)
xlim([0.25,0.50])
You can also use the Simulation Data Inspector, which gives nice interactive tools for plotting logged signals, please see https://www.mathworks.com/help/simulink/slref/simulationdatainspector.html

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scopes and Data Logging에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by