Observe the output in Matlab workspace

3 次查看(过去 30 天)
dx/dt=4x-6y
dy/dt=3x-7y+f(t)
where, f(t)=2t+1.
  3 个评论
Fangjun Jiang
Fangjun Jiang 2020-6-30
It is right. Drag a Clock block to connect to the Fcn block.
Fangjun Jiang
Fangjun Jiang 2020-6-30
Click the Run button and let the simulation finish. Then in Command Window, check the value of out.task. The plot() command depends on settings of the To Workspace block. Please show the output of out.task

请先登录,再进行评论。

回答(1 个)

Fangjun Jiang
Fangjun Jiang 2020-6-30
Assume "y" is "the output". Let's do it properly. In your Simulink model, double click the signal line out of the dy/dt Integrator block, and label it y. In your diagram, it is not clear whether y is a sigal label or just an annotation anywhere on the canvas.
Drag another To Workspace block and connect it to the line y. Double click, specify variable name as y and select "Timeseries" as the save format. After simulation, you can just do plot(out.y) to plot the curve.
Adding a Bus Creator block makes it hard for you. Other suggesions, don't use dy/dt, 4x-3y as the block name or signal label. They contain special characters or are invalid variable name.
  2 个评论
Fangjun Jiang
Fangjun Jiang 2020-6-30
If signals are not labeled, then it will show 'signal1', 'signal2'. etc.
It also depends on the save format, but you can always drill down the data to see
out.task.signal1
out.task.signal1.Time
out.task.signal1.Data
plot(out.task.signal1.Time, out.task.signal1.Data)
plot(out.task.signal1) would work if the save format is Timeseries.
Fangjun Jiang
Fangjun Jiang 2020-6-30
The above is for the case of logging Mux output. In your case, out.task will contain out.task.x and out.task.y or out.task.signal1 and out.task.signal2 if signals are not labeled.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by