how to draw the line of known slope and intercept
Mostrar comentarios más antiguos
Hello, I have a line which is in the form ax+by+c=0, with a,b and c known. In addition, I have a specific (x,y) point known, and the line should pass through it. How can I draw this line in matlab?
Respuesta aceptada
Más respuestas (4)
Daniel Shub
el 22 de Mayo de 2011
I like refline
doc refline
Matt Fig
el 22 de Mayo de 2011
You could also do it using MATLAB's polynomial functions...
% Data
a = -2;
b = 3;
c = 8;
x = 3;
y = -2/3;
% Now the plotting.
pp = [-a,-c]/b; % Polynomial as MATLAB likes it.
X = linspace(x-1,x+1); % Where to plot the line...
pv = polyval(pp,X); % Evaluate the polynomial.
plot(X,pv,'-b',x,y,'*r')
noor
el 17 de Jun. de 2011
0 votos
Hello, I'd like to know the slope for image 2D array. Need I draw line of known the slope? Thanks a lot
1 comentario
Walter Roberson
el 17 de Jun. de 2011
slope of a 2D array is a completely different concept. Please open a new Question for this, if you have not already done so.
Amr Aboughazala
el 6 de Mayo de 2022
0 votos
for a line ax + by - c
you can draw the line using the coefficients as follows,
y = -(a*x+c) / b
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!