フィルターのクリア

Plotting a complex inequality

9 ビュー (過去 30 日間)
Su_pat
Su_pat 2020 年 4 月 13 日
回答済み: Ameer Hamza 2020 年 4 月 13 日
Is there any way in Matlab that I can plot this inequality?
q(2p1+p2+p4 -1) <= 2sqrt [ (qp2 + (1-q)/4))*(qp4 + (1-q)/4) ] where q,p1,p2 and p4 are between 0 and 1.
So I have 2 complications here,
  1. How to plot an inequality?
  2. How to plot 4 variables? Can I use color schemes or contour plotting?

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 13 日
For your first question. You can plot an inequality with two variables like this
q = 1;
p4 = 2;
[p1, p2] = meshgrid(linspace(0,1,100));
s = q*(2*p1+p2+p4-1) <= 2*sqrt((q*p2 + (1-q)/4)*(q*p4 + (1-q)/4));
contourf(p1,p2,s+0, 'LineColor', 'flat');
xlabel('p1');
ylabel('p2');
For the second question, I am not sure how you can visualize it. With the help of slice(), it is somewhat possible to visualize 3 variables, but four variables cannot be visualized in a single graphic. Plotting several 2D plots by fixing the values of the other two variables is one of the ways.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by