plot([A(1), B(1)], [A(2), B(2)]), hold on
f = fit([A(1), B(1)]', [A(2), B(2)]', 'poly1')
f =
Linear model Poly1:
f(x) = p1*x + p2
Coefficients:
p1 = -3000
p2 = -0
fprintf('The coordinate of the intersection is (%.4f, %.4f).', xi, yi);
The coordinate of the intersection is (0.1250, -375.0000).
plot([A(1), B(1)], [A(2), B(2)], 'LineWidth', 2), hold on
plot(xr, yr, 'LineWidth', 2)
plot(A(1), A(2), 'o', 'LineWidth', 2, 'MarkerSize', 12)
plot(xi, yi, 'o', 'LineWidth', 2, 'MarkerSize', 12)
plot(B(1), B(2), 'o', 'LineWidth', 2, 'MarkerSize', 12), hold off
xline(C, '-', {'x = 0.125'}, 'color', '#123456'), grid on
xlabel x, ylabel y, xlim([0, 0.3])