plot several equation and extract vertices

4 次查看(过去 30 天)
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?

采纳的回答

Image Analyst
Image Analyst 2024-8-4
% 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');

更多回答(0 个)

类别

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

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by