plot several equation and extract vertices

1 visualización (últimos 30 días)
RICCARDO
RICCARDO el 4 de Ag. de 2024
Respondida: Image Analyst el 4 de Ag. de 2024
How can I plot in the same graph this 4 linear equations ?
y = 1
y = -4x + 1
x=4
2x+5y = 23
It's possible to extract algebraically vertexes of the quadrilateral picture?

Respuesta aceptada

Image Analyst
Image Analyst el 4 de Ag. de 2024
% First y=1
yline(1, 'Color', 'r', 'LineWidth', 2)
hold on;
% Next y = -4x + 1 over the x range of -5 to 5.
x = linspace(-5, 15, 1000);
y = -4 * x + 1;
plot(x, y, 'b-', 'LineWidth', 2);
grid on;
% Next x = 4
xline(4, 'Color', 'm', 'LineWidth', 2)
% Next 2*x + 5*y = 23
% or y = (23 - 2 * x) / 5
x = linspace(-5, 15, 1000);
y = (23 - 2 * x) / 5;
plot(x, y, 'g-', 'LineWidth', 2);
legendStrings = {'y = 1','y = -4x + 1','x=4','2x+5y = 23'};
legend(legendStrings, 'Location', 'southwest');

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by