2
$\begingroup$

I'm using one of the system models provided with Mathematica 11.3. (I found it by evaluating SystemModelExamples[].)

model = "DocumentationExamples.Simulation.LorenzAttractor";
simModel = SystemModelSimulate[model]
simModel["VariableNames"]
    (* {x', y', z', x, y, z} *)
simModel["StateVariables"]
    (* {x, y, z}  *)

I can plot x, y, z together against time t:

SystemModelPlot[simModel, {"x", "y", "z"}]

But how can I plot a trajectory of this system in a 3D space?

I tried

ParametricPlot3D[Evaluate[{x, y, z}], {t, 0, 10}]

(and the same thing but using names "x", "y", "z"), but the result is just an empty plot.

$\endgroup$
2
  • $\begingroup$ ParametricPlot3D[Evaluate[simModel[{"x", "y", "z"}, t]], {t, 0, 10}]? It's in the documentation for SystemModelSimulationData. $\endgroup$ Commented Apr 6, 2018 at 19:59
  • $\begingroup$ Ugh: I missed the first t. Still I find this confusing: Why in SystemModelPlot is there no explicit t, even though the plots of the 3 variables are all against time t? $\endgroup$
    – murray
    Commented Apr 6, 2018 at 20:20

1 Answer 1

5
$\begingroup$

SystemModelPlot doesn't do parametric plots. If you want parametric plots, you have to extract the variables from the SystemModelSimulationData result.

trajectory = simModel[{"x", "y", "z"}, t]
ParametricPlot3D[trajectory, {t, 0, 10}]

Or in a single step:

ParametricPlot3D[Evaluate@simModel[{"x", "y", "z"}, t], {t, 0, 10}]

Answering the comment: SystemModelPlot doesn't have an explicit t, since it doesn't need one. It always plots against time, so it would be tedious if you would have to specify it for each variable.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.