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!