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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Polygons 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by