stemStem plot
stem(y)y should be a real scalar, vector or matrix (array having 2 dimensions).y is a scalar, only the point [1, y] is plotted.y is a vector (row or column) of length k, then k data points is plotted.size(y) is a matrix of size [np,nl] with both np > 1 and nl > 1, then nl stem plots of np data points are plotted.'o' marker.y has a value of NaN, Inf or -Inf, the value is ignored and no point is shown for that value.y is real, it gives the same result as stem(1:np, y), where np is the number of rows of y.y is complex, it gives the same result as stem(1:np, real(y)).stem(y,spec)stem(y) above, but it has additional controls over line attributes using the specification string spec.spec should be 'filled' or a character vector specifying values of various line attributes.'filled' is used, the line color will be used as the marker face color.'filled' has no effect on markers for which color filling is impossible, for examples, cross 'x', dot '.', asterisk '*' and plus '+'.spec. The available ones are 'color', 'lineStyle' and 'marker'.'-r' means a solid line of red colour. An attribute value in a specification string can be over-written by a latter value in the same string. For example, '-.-' gives a solid line since '-.' (dash-dotted line) is overwritten by '-' (solid line). Similarly, 'blackred' gives a red line, instead of a black one.spec applies to all lines generated for y. Hence all lines have the same line and marker styles specified by spec.stem(1:np, y, spec) where np is the number of rows of y.stem(y,name1,value1,...,nameM,valueM)stem(y,spec,name1,value1,...,nameM,valueM)name1, ..., nameM are attribute names, and value1, ..., valueM are their associated values.spec can be overwritten by value1, ..., valueM.stem(x,y)stem(x,y,spec)stem(x,y,name1,value1,...,nameM,valueM)stem(x,y,spec,name1,value1,...,nameM,valueM)x and y should be scalars, vectors, or matrices of numeric values.
If y has size [m, n], where m >= 1 and n >= 1, then x should be either a matrix of the same size, or a vector of length m or n:
x is a matrix, then n lines of m data points will be plotted.x is a vector of length m, then n lines of m data points will be plotted. x is a vector of length n, then m lines of n data points will be plotted.If x or y is complex, only the real parts will be used.
See stem(y, 'spec') above for the description of the line specification string spec.
name1, ..., nameM are attribute names, and value1, ..., valueM are their associated values.
x = linspace(-2*pi,2*pi);
stem(x,sin(x))

stem(x,y) with y being a matrix, where np is the number of data points, and nl is the number of lines. Since x is a vector, all 3 stem plots have the same np = 20;
nl = 3;
y = rand(np,nl);
x = 1:np;
stem(x,y)
legend('show')
legend('Stem 1','Stem 2','Stem 3')
xlim([0.3 20.3])
ylim([-0.02 1.02])
rs and 'filled') and dashed-lines (--).y = rand(20,1);
x = 1:20;
stem(x,y,'--rs','filled')
xlim([0.3 20.3])
ylim([-0.02 1.02])
y = rand(20,1);
x = 1:20;
stem(x,y,'--rs','markersize',4,'markerfacecolor',[.4 .6 .7],'linewidth',3)
xlim([0.3 20.3])
ylim([-0.02 1.02])