Simulink input from workspace

Hello to everyone who knows? I have data (myData) from matlab workspace. And in matlab simulink I need to control a control system with a regulator. First, how to put the data (myData) in the simulation of the input model, and I want to show two values ​​in the graph (myData and regulator).

+4
source share
2 answers

You can use the From Workspace block to read data (e.g. simin ) from space.

The simin variable must contain a structure with the following fields:

  • signals:

    • Values: A column vector representing the data.

    • Description: A string describing the data (may be empty)

  • time: timestamp, its column vector, the size of which coincides with the size of the signal field (can also be empty)

This is for importing data into Simulink. To export data, you can use the In workspace block in the Simulink library.

Note that the output will also be a structure if you do not specify To Workspace as an array.

You can refer to the documentation here

thanks

+6
source

You can use the "From workspace" simulation block. If necessary, search the simulink library.

Your data from the workspace must have at least 2 columns, i.e. 1. Timestamp 2. Signal Both column vectors must be the same size if no error message appears.

For example, in the workspace

A <5x2 doubles>

<p> A = [14.3 0.5; 14.2 0.48; 14.1 0.44; 14.1 0.5; 14.6 0.6];

Then, in Simulink, using the From workspace, paste [A] into the Data field, as shown in the examples. See http://www.mathworks.com/help/simulink/slref/fromworkspace.html

Finally launch your simulink model! Enjoy

Β¬atck

0
source

Source: https://habr.com/ru/post/1383931/


All Articles