plot several equation and extract vertices
1 view (last 30 days)
Show older comments
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?
Accepted Answer
Image Analyst
on 4 Aug 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');
0 Comments
More Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!