Draw a line

49 visualizzazioni (ultimi 30 giorni)
Vibol TEAV
Vibol TEAV il 5 Giu 2011
Risposto: Steven Lord il 7 Nov 2022
I'm new to Matlab, I wanna draw a simple line x=4, or y=9. Someone kindly help me?

Risposta accettata

Matt Fig
Matt Fig il 5 Giu 2011
line([4 4],[0 10],'color','b') % Blue line from (4,0) to (4,10)
line([0 10],[9 9],'color','r') % Red line from (0,9) to (10,9)
axis([0 10 0 10]) % Set the axis limits
You can do the same thing with the PLOT command.
  1 Commento
Vibol TEAV
Vibol TEAV il 5 Giu 2011
Great, this is what I'm looking for. Thanks a million!!!

Accedi per commentare.

Più risposte (1)

Steven Lord
Steven Lord il 7 Nov 2022
If you're using release R2018b or later you can use the xline or yline functions.

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by