How do I create parallel lines in a certain interval like in the picture? I am pretty sure I can use line() but I have not managed to understand how.
Best Answer
Plotting lots of lines is not the correct solution, you should use thegrid command, or set theaxes grid properties (e.g. adjust tick-mark positions, grid linestyle, grid color, grid transparency, etc.). The MATLAB documentation gives examples of how to adjust the grid lines:
Currently the ticks and grid line spacing are associated and so the only way to change grid spacing is to change the tick spacing. Here are some examples:
In order to change the style of the major gridlines, use the SET command as in the following example:
plot(1:10)
grid
set(gca,'gridlinestyle','-')
grid minor
This example will draw the major grid lines and change their style to solid (using the SET command for the axes GridLineStyle property) and then draw the minor grid lines without changing their linestyle.
Best Answer