Graph limits and area

1 回表示 (過去 30 日間)
Mughees Asif
Mughees Asif 2019 年 3 月 6 日
コメント済み: KSSV 2019 年 3 月 6 日
I have the following code:
x = linspace(-5, 5, 1000);
y1 = -x;
y2 = x.^2-4;
lidx = y1 >= y2;
figure
set(findobj(gcf,'type','axes'),'FontName','Arial','FontSize',12,'FontWeight','Bold', 'LineWidth', 2);
plot(x, y1, 'k')
hold on
plot(x, y2, 'k')
patch([x(lidx) fliplr(x(lidx))], [y1(lidx), fliplr(y2(lidx))], 'b', 'FaceAlpha', 0.4)
hold off
xlim([-5 5])
ylim([-5 5])
box on
grid on
axis=gca;
axis.XAxisLocation = 'origin';
axis.YAxisLocation = 'origin';
title('Graph of the integration domain')
xlabel('x')
ylabel('y')
which gives the following graph. Is there a way of putting dashed lines where the green line is to show limits and to reduce the blue patch within the area. Thank you.
graph_Mathworks.png
  1 件のコメント
KSSV
KSSV 2019 年 3 月 6 日
Get those intersection points and use patch.

サインインしてコメントする。

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by