Plotting 3d phase space using Simulink and Matlab
Show older comments
Hello, and thanks for your help.
I have made a simulink simulation that outputs 3 state variables (x1,x2,x3) like this:

I need to plot the evolution of said state variables in a 3d phase plot inside Simulink, the graph doesn't have to update in real time, it's fine if it appears after the simulation is complete.
As you can see, I tried using a matlab block that contains the following code:
function plot3d(x1,x2,x3)
hold on;
grid on;
plot3(x1,x2,x3);
However, this code outputs nothing, what's even worse, once the simulation is complete all I see is a blank 2d graph. I'd like to know whether there's some Simulink function that allows me to do what I want (I could find none so far), or how I can improve my code to achieve the desired output.
Thank you.
Answers (0)
Categories
Find more on Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!