Plotting a dashed line onto a graph
84 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
So here's my graph:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/829255/image.png)
How do I add a dashed line that originates from a particular point somewhere in the middle of the plot on each of the graphs? For example, I would like my dashed line to start at the point 3 on the x-axis for the green curve on the bottom of the second graph and will terminate at point 5
Observe the following graph I'm trying to replicate, notice the dashed lines originating from a particular point on each of the graphs then terminates at the end. I'm not recreating parts b. and d. like this graph has it so not worried about dashed lines extending beyond the the end of the axis for parts a. and c.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/829260/image.jpeg)
0 comentarios
Respuestas (1)
M.B
el 10 de Dic. de 2021
add this to your plot:
x_from = 3;% the dotted line starts at x = 3
x_to = 5;% the dotted line finished at x = 5
yvalue = 2.3;% the line will have an amplitude of 2.3
plot([3 5], [yvalue yvalue], 'b:');% b for blue, r for red, g for green , k for black ...
0 comentarios
Ver también
Categorías
Más información sobre 2-D and 3-D 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!