Need some help learning Simulink
2 次查看(过去 30 天)
显示 更早的评论
I'm having some trouble with Simulink. I need to be able to frame the input to an integration routine in terms of the time variable, t. I do this with a Matlab function, but "t" isn't the value of the variable that is produced. I don't know how to use "t" in this manner. (I'm defining a function for Fx as t^2, which winds up as u^2.)
I also need to model the output both as a plot file and as a data printout. I don't seem to be able to produce this.
Does anyone have the Matlab background necessary to understand this Simulink problem? Thank you.
Sincerely,
Del Ventruella
0 个评论
回答(1 个)
Raghava S N
2024-9-25
Hey,
The “Clock” block in Simulink outputs the current simulation time at each simulation step. This block is useful for other blocks that need the simulation time. The output of the “Clock” block should be connected to the input of the MATLAB function block. As a result, the output of the MATLAB Function block will be “t^2”. For more information about the “Clock” block in Simulink, refer to the following link - https://www.mathworks.com/help/simulink/slref/clock.html.
The Simulink Data Inspector can be used to create plots and view the outputs of the simulation. Right click on the signals that need to be plotted and select “Log Selected Signals”. This enables signal logging with the Simulink Data Inspector. After the simulation is completed, clicking on the blue icon on top of the logged signals launches the Simulink Data Inspector. More information about creating plots using Simulink Data Inspector can be found here - https://www.mathworks.com/help/simulink/ug/create-plots-with-the-simulation-data-inspector.html.
To save the output as raw data, the “To File” block in Simulink can be used. The data can be saved to a “.mat” file as a Timeseries object or as a MATLAB Array, by setting the “SaveFormat” parameter. Refer to this link for more information about saving simulation data - https://www.mathworks.com/help/simulink/slref/tofile.html.
I have attached the Simulink model with the modifications listed above. Hope it helps!
3 个评论
Raghava S N
2024-9-26
Sure, I have attached the model compatible with MATLAB R2019b.
With regards to working with MATLAB and Simulink simultaneously, I would suggest you to take a look at these self-paced online courses that give you a basic overview of working with MATLAB and Simulink -
Simulink Onramp - https://matlabacademy.mathworks.com/details/simulink-onramp/simulink
Feel free to ask any more questions!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 String 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!