plotyy
Example 1
x = 0:0.01:20 y1 = 50*sin(x) y2 = cos(x) plotyy(x, y1, x, y2)
Example 2
op1 = struct op2 = struct op1.lineStroke = 'green' op2.lineStroke = 'red' op2.dashArray = '2 3' x = 0:0.1:10 y1 = exp(-x).*sin(x) y2 = 2*exp(x) plotyy(x, y1, x, y2, op1, op2)
Example 3
options = struct x = -10:0.1:10; options.yAxisColor = 'blue' options.y2AxisColor = 'green' y1 = exp(-(x*2-1).^2)*5 y2 = exp(-(x/2+1).^2)/5 plotyy(x, y1, x, y2, options)
Example 4
op1 = struct op2 = struct op1.lineStroke = 'green' op2.lineStroke = 'red' op2.dashArray = '2 3' op1.xAxisTicks = 4 x = [2003 2004 2005 2006] y1 = [10 20 30 50] y2 = [50 30 40 10] plotyy(x, y1, x, y2, op1, op2)
Example 5
op1 = struct op2 = struct op1.yAxisScale = 'Log' op2.y2AxisScale = 'Linear' x = 0:900; A = 1000; a = 0.005; b = 0.005 z1 = A*exp(-a*x) z2 = sin(b*x) plotyy(x, z1, x, z2, op1, op2)
Example 6
x = linspace(0,10,200) y1 = 200*exp(-0.05*x).*sin(x) y2 = 0.8*exp(-0.5*x).*sin(10*x) y3 = 0.2*exp(-0.5*x).*sin(10*x) plotyy(x, y1,[x',x'],[y2',y3'])
Related documentation
Basic Options and Setup - GeneralBasic Options and Setup - Axes
Basic Options and Setup - Frame and Canvas
Basic Options and Setup - Lines, Markers, Areas and Bars
Basic Options and Setup - Legend
Basic Options and Setup - Labels
2D graphs - Secondary Axis
2D graphs - Formatting Axes