I am given set of five linear inequalities how to plot the graph showing the common area

How can I draw 2D plot for these set of linear inequalities with ki representing x-axis and kd representing y-axis.The common area that is a convex polygon formed by these inequalities must be seen in the plot.The polygon should be in a way represented by picture below.

 채택된 답변

Matt J
Matt J 2021년 2월 2일
편집: Matt J 2021년 2월 2일
You can use lcon2vert,
to obtain the vertices V of the region. Then use plot(polyshape(V)).
A=[1,0;
1,-0.2699;
1,-0.3666;
-1,+3.5358
1,-13.5777];
b=[0,-4.6836,-10.0797,-3.912,140.2055].';
V=lcon2vert(A,b);
plot(polyshape(V))

댓글 수: 13

I am getting this error please help me
That's because you didn't download lcon2vert from the link I gave you.
Laxmi Akshaya Thela's asnwer moved here
Can u please help me to get 3D plot for these equations with kp,ki,kd as the 3 axis .
While trying to plot for the above set of equations I was getting he below error.
Error using lcon2vert>con2vert (line 326)
Non-bounding constraints detected. (Consider box constraints on variables.)
Error in lcon2vert (line 254)
Zt=con2vert(AAA,bbb,TOL,checkbounds);
For the above equations the plot should be as in the pic below :
Please help me out with this I have got to submit an assignment.
I need to see your code (as text, not as an imge).
Laxmi Akshaya Thela's comment moved here:
A=[1,0;1,-1;1,-15];
>> b=[0,-1,-55];
>> V=lcon2vert(A,b);
Error using lcon2vert>con2vert (line 326)
Non-bounding constraints detected. (Consider box constraints on variables.)
Error in lcon2vert (line 254)
Zt=con2vert(AAA,bbb,TOL,checkbounds);
This is the code that I used..The same one which you have sent.The code that you have sent is working fine for the set of equations that I have given two days back.But dont know why for the present set of equations it is showing an error.
I am getting the 2D plot there is no issue with that I gave the signs wrong so it was showing an error.
Just help me about the how to get the 3D as obtained in the below pictures.I am required to get multiple Triangles on the 3D plot.The first plot represents the solution to below code
A=[1,0;-1,1;1,-15];
b=[0,1,55];
V=lcon2vert(A,b);
plot(polyshape(V))
By using the above code I am able to get it on 2D plot.
I want to know how to get it on 3D plot as shown in fig below?
Thank you patch() command is working.
I have got one more doubt.
A=[1,0;-1,0.3577;1,-1.2241;-1,11.418];
b=[0,-0.4921,1.6767,98.493];
V=lcon2vert(A,b);
plot(polyshape(V));
xlabel('Ki');
ylabel('kd');
For the above code I am getting the below error :
Error using polyshape/getXY (line 672)
x- and y-coordinate matrix must have 2 columns with at least 3 rows.
Error in polyshape/checkInput (line 842)
[X, Y, xy2input, next_arg] = polyshape.getXY(varargin{:});
Error in polyshape (line 169)
[X, Y, tc, simpl, collinear] = polyshape.checkInput(param, varargin{:});
Error in polygon (line 4)
plot(polyshape(V));
Please help me resolve this error .What should I be doing about this error?
Your polygon is empty
>> A=[1,0;-1,0.3577;1,-1.2241;-1,11.418];
b=[0,-0.4921,1.6767,98.493];
V=lcon2vert(A,b)
V =
[]
How to apply grids for a 3d plot, my 3d plot is not very clear because of the small values.So,I want to apply grid to my plot.Please help me out with this issue.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Matt J
Matt J 2021년 2월 3일
There is also this File Exchange submission,
It does not require the vertices to be precomputed, and works for either 2D or 3D.

카테고리

Community Treasure Hunt

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

Start Hunting!

Translated by