12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

legendExamplesAdd a legend to a graph showing a sine and cosine function:x = –pi:pi/20:pi;plot(x,cos(x),'−ro',x,sin(x),'−.b')h = legend('cos','sin',2);10.8cossin0.60.40.20−0.2−0.4−0.6−0.8−1−4 −3 −2 −1 0 1 2 3 4In this example, the plot command specifies a solid, red line ('−r') for thecosine function and a dash-dot, blue line ('−.b') for the sine function.See AlsoLineSpec, plot2-260

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!