Lecture 10 - 11/15/2010 Lecture 10: Graphics in MATLAB BMEn...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
11/15/2010 1 Lecture 10: Graphics in MATLAB BMEn 2401 Programming for Biomedical Engineers Rich Beck November 16, 2010 1 2-D plots: plot command plot(x,y) is used to plot vector y versus vector x . Example: x = linspace(0,2*pi,100); y = sin (x); plot(x,y) 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
11/15/2010 2 2-D plots: plot command plot(x,y, 'line specifier') Example: x = linspace(0,2*pi,20) y = sin (x) plot(x,y,'o-.r') 3 Specifiers Line Specifiers: solid (default) - dashed -- dotted : dash-dot-. blue (default) b Color Specifiers: green g red r cyan c magenta m yellow y black k white w Marker Specifiers: asterisk * plus sign + circle o point . square s diamond d five-point star p cross x triangle (Up) ^ triangle (down) v triangle (left) < triangle (right) > six-point star h 4
Background image of page 2
11/15/2010 3 Other useful commands title ('S_t') adds the title 'S_t' to the graph. xlabel ('S_x') adds a label to x axis. ylabel ('S_y') adds a label to y axis. text (x0,y0, 'text string') add the string value at x0 and y0 on the graph. axis off removes the axis. axis on (default) brings the axis back. grid off (default) removes the grid lines. grid on adds major grid lines. 5 Example x = linspace(0,2*pi,20) y = sin (x) plot(x,y,'p:g') title('SIN(X) versus X') xlabel('X') ylabel('SIN(X)') text (pi+pi/6,0, ' At this point sin(x) is negative') 6 Note: This command should be in one line.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
11/15/2010 4 fplot command fplot ('function', limits, 'line specifiers')
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/10/2011 for the course BMEN 2051 taught by Professor S during the Fall '10 term at Minnesota.

Page1 / 11

Lecture 10 - 11/15/2010 Lecture 10: Graphics in MATLAB BMEn...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online