Observe the output in Matlab workspace

5 visualizaciones (últimos 30 días)
AMIRAH ZAKIRAH
AMIRAH ZAKIRAH el 29 de Jun. de 2020
Editada: AMIRAH ZAKIRAH el 1 de Jul. de 2020
dx/dt=4x-6y
dy/dt=3x-7y+f(t)
where, f(t)=2t+1.
  3 comentarios
Fangjun Jiang
Fangjun Jiang el 30 de Jun. de 2020
It is right. Drag a Clock block to connect to the Fcn block.
Fangjun Jiang
Fangjun Jiang el 30 de Jun. de 2020
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

Iniciar sesión para comentar.

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 30 de Jun. de 2020
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 comentarios
Fangjun Jiang
Fangjun Jiang el 30 de Jun. de 2020
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 el 30 de Jun. de 2020
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.

Iniciar sesión para comentar.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by