Azzera filtri
Azzera filtri

Graph limits and area

1 visualizzazione (ultimi 30 giorni)
Mughees Asif
Mughees Asif il 6 Mar 2019
Commentato: KSSV il 6 Mar 2019
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 Commento
KSSV
KSSV il 6 Mar 2019
Get those intersection points and use patch.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by