Observe the output in Matlab workspace

조회 수: 2 (최근 30일)
AMIRAH ZAKIRAH
AMIRAH ZAKIRAH 2020년 6월 29일
편집: AMIRAH ZAKIRAH 2020년 7월 1일
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