% Variables d = 0.05; % Offset for labels % Calculate the parabolas x = [-1:0.001:1]; y = [-1:0.001:1]; y_t = (1 - x.^2) / 2; % top parabola y_b = (x.^2 - 1) / 2; % bottom parabola x_l = (y.^2 - 1) / 2; % left parabola x_r = (1 - y.^2) / 2; % right parabola % Plot the axes plot([0, 0], [1, -1], 'k-', [1, -1], [0, 0], 'k-'); hold on; % Plot the centre plot(0, 0, 'o'); text(0 + d, 0 + d, 'C (0, 0)'); % Plot the parabolas plot(x, y_t, 'b.', x, y_b, 'b.', x_l, y, 'b.', x_r, y, 'b.'); text(0 - d, 0.5 - d, 'x^2 = 1 - 2y'); % label for top parabola text(0 - d, -0.5 + d, 'x^2 = 1 + 2y'); % label for bottom parabola text(-0.5 + d, 0 + d, 'y^2 = 1 + 2x'); % label for left parabola text(0.5 + d, 0 + d, 'y^2 = 1 - 2x'); % label for right parabola % Plot the intersection points r = sqrt(2) - 1; rlabel = strcat(';r = ', num2str(r), ';'); plot(r, r, strcat('ro', rlabel)); % 1st quadrant text(r + d, r + d, 'B (r, r)'); plot(-r, r, 'ro'); % 2nd quadrant text(-r + d, r - d, 'A (-r, r)'); plot(-r, -r, 'ro'); % 3rd quadrant text(-r + d, -r + d, 'D (-r, -r)'); plot(r, -r, 'ro'); % 4th quadrant text(r + d, -r + d, 'C (r, -r)'); grid('on'); xlabel('x'); ylabel('y'); title(strcat('All points within the closed region, ABCD, is closer ', 'to the centre than the edges.')); hold off; replot; print('graph.png');