# stem

Version:

Generates a stem plot. You can use stem plots to display an impulse response.

Note

You can only use the stem function in the MathScript Console.

## Syntax

stem(y)
stem(y, 'filled')
stem(y, attributes)
stem(x, y)
stem(x, y, 'filled')
stem(x, y, attributes)
stem(x, y, 'filled', attributes)

## x

Real vector or matrix you want to plot.

## y

Real vector or matrix you want to plot.

## filled

Uses solid circles for the stem plot.

## attributes

Valid plot attributes. Order the plot attributes by color, point style, and line style. For example, 'bo-' specifies that the plot is blue, marks points with circles, and uses solid lines. attributes is a string that accepts a combination of the following values:

Name Description
'b'

Colors the plot blue.

'c'

Colors the plot cyan.

'g'

Colors the plot green.

'k'

Colors the plot black.

'm'

Colors the plot magenta.

'r'

Colors the plot red.

'w'

Colors the plot white.

'y'

Colors the plot yellow.

'.'

Marks points with dots.

'o'

Marks points with circles.

'x'

Marks points with crosses.

'+'

Marks points with plus signs.

'*'

Marks points with asterisks.

'-'

Uses solid lines.

':'

Uses dotted lines.

'-.'

Uses dashed and dotted lines.

'--'

Uses dashed lines.

## Syntax Variants

• stem plots y as stems originating in x.
• stem(y) plots the columns of y against the indexes of the columns.
• stem(y, 'filled') plots y against the indexes of the columns using solid circles for the stem plot.
• stem(y, attributes) plots y against the indexes of the columns using the specified attributes.
• If x and y are real vectors, stem(x, y) plots y against x.
• stem(x, y, 'filled') plots y against x using solid circles for the stem plot.
• stem(x, y, attributes) plots y against x using the specified attributes.
• stem(x, y, 'filled', attributes) plots y against x using the specified attributes and uses solid circles for the stem plot.
X = [0:0.1:1];
Y = X.*X;
stem(X, Y, 'r')

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices