views:

50

answers:

2

I would like to use jtraj to specify a trajectory in a Simulink model. Below are what I attempted to retrieve in the command prompt:

Q0 = [1 1 0];
Q1 = [1+0.5*cos(2*20) 1+0.5*sin(2*20) 0];
t = 0:0.1:20;
[Q, Qd, Qdd] = jtraj(Q0, Q1, t);

However, I don't know how to include such trajectory data in the Simulink model easily. Any comments?

Thanks in advance.

+1  A: 

If I understand your question correctly, you want to import some time-dependent data as a signal in a Simulink model, correct? There are two ways you can do this,

  1. Using a root inport, and then importing the data using the Input field on the Data Import/Export page of the configuration parameters. See the documentation for more information.
  2. Use a From Workspace block to import the data from the base workspace.
MikeT
That's exactly what I used (the second case).
stanigator
A: 

i think there is some ways: you can write your data to m-file (for example by test.m name) then befor running simulink model, you can run this m-file, in this case you can use Constant block whit variable's name that exists to workspace.

Elmoya