MATLAB Examples

This is an example showing standard line styles available in MATLAB® plots.

Read about the plot function in the MATLAB documentation.

For more examples, go to MATLAB Plot Gallery

% Generate some data using the besselj function
x = 0:0.2:10;
y0 = besselj(0,x);
y1 = besselj(1,x);
y2 = besselj(2,x);
y3 = besselj(3,x);

% Plot the lines from the Bessel functions using standard line styles
plot(x, y0, 'r-', x, y1, 'g--', x, y2, 'b:', x, y3, 'k-.')