You are on page 1of 1

% Define the range for x

x_range = -1.5:0.01:1.5; % Adjust the step size (0.01) as needed

% Calculate corresponding y values based on the equation (considering y > 0)


y_positive = sqrt(25/4 - x_range.^2);

% Plot the locus


figure;
plot(x_range, y_positive, 'b', 'LineWidth', 2);
title('Locus of x^2 + y^2 = 25/4 in Square Box');
xlabel('x');
ylabel('y');
grid on;

% Highlight the specific range (-1.5 <= x <= 1.5)


xlim([-1.5, 1.5]);
ylim([0, 2]); % Adjust the y-axis limits based on your preference

% Add labels for the condition x >= -1.5 and x <= 1.5
text(-1.5, 0, 'x \geq -1.5', 'HorizontalAlignment', 'right');
text(1.5, 0, 'x \leq 1.5', 'HorizontalAlignment', 'left');

% Display a square box


rectangle('Position', [-1.5, 0, 3, 2], 'EdgeColor', 'r', 'LineStyle', '--',
'LineWidth', 1);

legend('Locus', 'x^2 + y^2 = 25/4', 'Location', 'NorthEast');

You might also like