draw a line with known slope and one set of coordinates

29 visualizaciones (últimos 30 días)
KLR
KLR el 7 de Jul. de 2020
Respondida: dpb el 7 de Jul. de 2020
I know the coordinates of the starting position of the line (x1,y1). I also know the angle the line makes how to find the second set of coordinates and plot the line?

Respuesta aceptada

dpb
dpb el 7 de Jul. de 2020
m=tan(theta); % tan()=y/x --> slope
b=y1-m*x1; % intercept to pass thru x1,y1 at given slope.
coeff=[m b]; % coefficient array for convenience
yh=polyval(coeff,[x1 xEnd]); % evaluate line from x1 to some end point of choice

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by