How do I input variables into a Simulink model through MATLAB script (SimDriveline)

29 views (last 30 days)
For my coursework project in MATLAB, I have decided to build a drive-line model within Simulink, using the SimDriveline toolbox. The idea is to get the user to input values for the various parameters that are associated with each part of the model, such as the engine or the transmission. I would like to able to write this in a MATLAB script, but I'm not sure how to assign the values that are input to the Simulink model. For instance, the stock sdl_vehicle example that comes with SimDriveline. I am aware of the sim() command, but I am still confused on how to use it properly.
Also at the end of the simulation, the program is supposed to display the graphs that are collected in the scope window. I know that in the window itself that the scope can be printed to a figure, but is it possible to print that scope to a figure through MATLAB script?
This is the first time I have ever used a program like MATLAB. I would appreciate any help I could get, many thanks in advance!

Answers (1)

Vineeth Kartha
Vineeth Kartha on 14 Mar 2016
Hi,
In the blocks that you are using please use variable names and then you can write a script that uses the 'input()' to get values from the user for the variables. After all the variables have been read. Issue the 'sim()' command. I have attached a very simple Simulink model and its associated script. Please use it as a reference.
Hope this helps.

Categories

Find more on Simscape Driveline in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!