0
$\begingroup$

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?

$\endgroup$
2
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ Sorry I had to edit my question and delete details, but I was talking to my professor to understand the model he wrote, and he asked me to not share it on internet. I appreciate a lot your help anyway. I tried to keep the essential in order to maintain the sense of the post. Thanks. $\endgroup$ – J.D. Oct 3 '20 at 8:34
  • $\begingroup$ FYI the edit history is kept and is public on Robotics SE $\endgroup$ – 50k4 Oct 4 '20 at 21:45
  • $\begingroup$ Yes I know, but I cannot delete questions which have been answered. So this is the best I can do I guess. Thanks. $\endgroup$ – J.D. Oct 8 '20 at 5:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.