How to draw lines in matlab
Show older comments
Suppose x axis values are (30,40,50) and its corresponding y-axis values are (100,200,300). How to draw three different line in a plot with (30,100) one line,(40,200) one line and (50,300) one line. Thank you.
Answers (1)
X = [30,40,50] ;
Y = [100,200,300] ;
plot(X,Y,'.-r')
REad about plot
6 Comments
Aditya Shau
on 27 Jul 2018
Edited: Aditya Shau
on 27 Jul 2018
KSSV
on 27 Jul 2018
Vertical lines? YOu need to have data to plot what you have shown in figure.
Aditya Shau
on 27 Jul 2018
Edited: Aditya Shau
on 27 Jul 2018
x = 10:10:50. ;
y = 100:100:500 ;
[X,Y] = meshgrid(x,y) ;
plot(Y,X,'k')
Aditya Shau
on 27 Jul 2018
Wilmar Lima
on 11 Nov 2019
X = [30,0];
Y = [0,100];
plot(X,Y,'.-r') A red line
Categories
Find more on Image Preview and Device Configuration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!