필터 지우기
필터 지우기

Plotting an Array in Simulink with the Simulation time on X-Axis

조회 수: 3 (최근 30일)
Abdelrahman Alamoudi
Abdelrahman Alamoudi 2018년 12월 28일
댓글: Viren Gupta 2019년 1월 7일
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

답변 (1개)

Viren Gupta
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
Abdelrahman Alamoudi
Abdelrahman Alamoudi 2019년 1월 4일
Hi,
Thanks a lot for your Answer but would you please explain this more in details? In my Workspace I have t as (1800*1) and v as (1800*1) vectors. Now I'll open Simulink and from the Toolbar I'll go to Simulation then to Model configuration parameters and then I guess under "Load from Workspace" is Input [t,u] I should be changing it to [cycle.t , cycle.v] because my t and v are under Cycle in my Workspace. Now in my Block window, which Block should I be connecting to Scope to get the graph? When I use the Input block how do I change the variables inside it to v and t ? How many plugs should the scope have? Thanks for your help.
Viren Gupta
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 CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by