plotyy(x1, y1, x2, y2)
plotyy(x1, y1, plotspec1, x2, y2, plotspec2, logspec)
Inputs  
x1 
A real matrix. Independent variable for the left axis. 
y1 
A real matrix with the same number of rows as x1. Dependent variable for the left axis. 
x2 
A real matrix. Independent variable for the right axis. 
y2 
A real matrix with the same number of rows as x2. Dependent variable for the left axis. 
plotspec1 
The plot specification string for the plot for the left axis. 
plotspec2 
The plot specification string for the plot for the right axis. 
logspec 
One of the strings 'semilogx' , 'semilogy' , 'loglog' , to specify the logarithmic scaling of one or more of the axes, if needed.

x1
is a vector, every column of y1
is plotted against x1
. Otherwise, every column of y1
is plotted against the corresponding column of x1
. The data in the pair x2, y2
is plotted in a similar fashion, but according to indpendent scaling which is displayed on the yaxis
on the right of the plot. The plotspec
strings are used to define the line types, colors and markers as defined in plot.
>>x=[1:.01:1] >>y=sin(pi*x); >>z=5sin(pi*pi*x.*x); >>plotyy(x,y,x,z,'r:pf5') >>legends({'sin(pi x)','5sin([pi x]^2)'}); >>ylabel('Y Axis') >>xlabel('X Axis') >>ylabelRight('Right Y Axis') >>title('Plot with Two Y Axes')