TransWikia.com

How do I call Matlab code into Simulink for doing a simulation for doing plots?

Robotics Asked by J.D. on October 20, 2020

I have built a simulink model for performing cartesian regulation on a unicycle:

enter image description here

and plot the results with a Matlab code

but, I am not very confident with Simulink and so I don’t know how to call these codes into my Simulink model.

Can somebody please help me?

One Answer

There's a Matlab function block. Follow the example and your inputs and outputs will create source/sink connections on the Simulink block to wire in values.

I would only put the controller in there, and don't use the clear all command - if it's not persistent then a variable inside a function ceases to exist between function calls. Every call to the function wipes all the internal variables inside that function.

If you're wanting your data to be plotted at the end then you can use a To Workspace block and send the data out that way and plot from the console or script after the Simulink project finishes.

Answered by Chuck on October 20, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP