plot several equation and extract vertices

1 Ansicht (letzte 30 Tage)
RICCARDO
RICCARDO am 4 Aug. 2024
Beantwortet: Image Analyst am 4 Aug. 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?

Akzeptierte Antwort

Image Analyst
Image Analyst am 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');

Weitere Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by