n-dimensional Polyhedron plotting using 2-dimensional plot commamnd

3 次查看(过去 30 天)
I have a 4-dimensional system with 4 states x=(x1, x2, x3,x4) as follow:
A =[ 0 1 0 0
0 -6.7811 203.43 1.6275
0 0 0 1
0 0.89105 -26.732 -6.8804];
B =[ 0
101.72
0
61.26];
xmin = [-2; -5;-4; -2];xmax = [0; 50; 10; 10];
umin =-5;umax =5;
and a I must plot a Polyhedron as follow only for x1 , x2
X = Polyhedron('lb',model.x.min,'ub',model.x.max);
above-mentionaed Polyhedron is 4-dimentional and it is not possible to plot it.
i want to plot this polyhedron in 2-dimensional page only for x1 and x2 states such that x1 state is considered as horizontal axis and x2 state is considered as vertical axis.
How can I do that in Matlab?

回答(1 个)

Harsh Sharma
Harsh Sharma 2024-8-23
Hi Morteza,
As per my understanding of the question you want to plot a “Polyhedron” in a 2-dimensional plot using only two of its axes (“x1” and “x2” specifically)
I believe the “Polyhedron” you are using is from the MATLAB based MPT3 library and if not, you can use the following instructions to install it - https://www.mpt3.org/Main/Installation#:~:text=If%20you%20for%20any%20reason%20cannot%20use%20tbxmanager%2C,5%20Save%20your%20Matlab%20path%20for%20later%20use
As you have mentioned, it is not possible to plot a 4-dimensional figure. However, you can plot the projection of the 4-D figure on a 2-D plane by using only the x1 and x2 states.
Here’s the code to achieve that:
xmin = [-2; -5;-4; -2];
xmax = [0; 50; 10; 10];
X = Polyhedron('lb',xmin,'ub',xmax);
P = X.projection([1,2]);
P.plot()
Hope this answers your question!

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by