Plotting an Array in Simulink with the Simulation time on X-Axis
조회 수: 7 (최근 30일)
이전 댓글 표시
Hello Guys,
I'd be really thankful if somebody would answer my question.
I am working on a project in my college where I need to build different subsystems simulating an electric car on Simulink. Subsystems such as "Wheel" , "Gearbox" , "Electric Engine" , "Battery" etc. and in the end I should be connecting them all together and start getting my values. The very first subsystem is called " Cycle " and In this subsystem I must use my given variable "V" which is the speed of the car. V is an array with 1800 rows and 1 column stating the speed of the car in KM/H for every second for 1800 seconds (30 Min Total). (It's all about the WLTP Car Test where a Car will be accelerated and deccelerated for 30 Min continious). My very first substem "Cycle" should plot a graph with this speed according to the simulation time ( What I understood I'll change the simulation time to 1800 Seconds and I need to get V drawn for every second up to 1800 seconds so the graph with be plotted) . My second Subsystem will be "Wheel". Wheel should be able to calculate my Wheel RPM and my Wheel Toque using the Speed graph (Speed array) from my first subsystem "Cycle". I have spent already 10 Hours playing around Matlab and Simulink to get an idea of how to start but I failed. Does anybody have a solution? I am really thankful.
Kind Regards
댓글 수: 0
답변 (1개)
Viren Gupta
2019년 1월 4일
Hi,
For giving the input as an array (1800*1), you can directly set the Input parameter in Data imprt/Export parameter as [t,u]. Make sure you have t and u present in the workspace as 1800*1 vectors. t will be time based vector as [1;2;3....1800] and u will the speed vector. For graph, you can use the scope block. You other subsystems like Wheel should be able to use the same inputs.
댓글 수: 2
Viren Gupta
2019년 1월 7일
You can use the in1 block. This needs to be connected to the scope. Now yoy should be able to run the model and see the graph in scope block.
참고 항목
카테고리
Help Center 및 File Exchange에서 Automotive Applications에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!