MATLAB Answers

Locks
0

draw lines based on coordinates

Asked by Locks
on 17 Nov 2014
Latest activity Commented on by Siam
on 17 Nov 2014
Hi,
I am looking for a way to add a line to a convex function based on the coordinates.
I have a convex funtion going from x=1, y=19.99 to x=17, y=18.57. How is it possible to draw a straigt line between those two coordinates?
Thank you very much for the help!

  0 Comments

Sign in to comment.

1 Answer

Answer by Siam
on 17 Nov 2014
 Accepted Answer

You can try this to draw the line
x = [1 17];
y= [19.99 18.57];
line(x,y,'Color','r','LineWidth',4)
You can change the color as 'r' is for red and line width as well which is 4 for this case.

  4 Comments

Show 1 older comment
Siam
on 17 Nov 2014
Do you mean straight line will act as the diameter for the circle?
Locks
on 17 Nov 2014
Just a small cicle at the beginning and the end of each line, as i tried to do it manually on the Picture. In Addition, also one in the middle, I'd like to Show that for a convex function the straight line is above the curved one.
Siam
on 17 Nov 2014
Please open a new question and provide some more information with a demo image if possible.

Sign in to comment.