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.

plotyyPurpose2plotyyCreate graphs with y axes on both left and right sideSyntaxDescriptionplotyy(X1,Y1,X2,Y2)plotyy(X1,Y1,X2,Y2,'function')plotyy(X1,Y1,X2,Y2,'function1','function2')[AX,H1,H2] = plotyy(...)plotyy(X1,Y1,X2,Y2) plots X1 versus Y1 with y-axis labeling on the left andplots X2 versus Y2 with y-axis labeling on the right.plotyy(X1,Y1,X2,Y2,'function') uses the plotting function specified by thestring 'function' instead of plot to produce each graph. 'function' can be plot,semilogx, semilogy, loglog, stem or any <strong>MATLAB</strong> function that accepts thesyntax:h = function(x,y)plotyy(X1,Y1,X2,Y2,'function1','function2') uses function1(X1,Y1) toplot the data for the left axis and function1(X2,Y2) to plot the data for theright axis.[AX,H1,H2] = plotyy(...) returns the handles of the two axes created in AXand the handles of the graphics objects from each plot in H1 and H2. AX(1) isthe left axes and AX(2) is the right axes.ExamplesCreate a graph using the plot function and two y-axes.t = 0:pi/20:2*pi;y1 = sin(t);y2 = 0.5*sin(t-1.5);plotyy(t,y1,t,y2,’plot’)2-362

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

Saved successfully!

Ooh no, something went wrong!