Table Of Contents


    Last Modified: January 9, 2017

    Generates a plot.


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


    plot(y, attributes)
    plot(x, y)
    plot(x, y, attributes)
    plot(x1, y1, x2, y2, ..., xN, yN)
    plot(x1, y1, x2, y2, ..., xN, yN, attributes)
    plot(x1, y1, attributes1, x2, y2, attributes2, ..., xN, yN, attributesN)



    Vector or matrix you want to plot.


    Vector or matrix you want to plot.


    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

    Colors the plot blue.


    Colors the plot cyan.


    Colors the plot green.


    Colors the plot black.


    Colors the plot magenta.


    Colors the plot red.


    Colors the plot white.


    Colors the plot yellow.


    Marks points with dots.


    Marks points with circles.


    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.


    Further vector or matrix.


    Further vector or matrix.


    Further plot attributes.


    Further vector or matrix.


    Further vector or matrix.


    Further plot attributes.


    Further vector or matrix.


    Further vector or matrix.


    Further vector or matrix.


    Further plot attributes.

    Syntax Variants

    • plot(y) plots the columns of y against the indexes of the columns. If y is complex, plot(y) plots imag(y) against real(y).
    • plot(y, attributes) plots the columns of y against the indexes of the columns using the specified attributes. If x and y are real vectors, plot(x, y) plots y against x. If x or y is complex, plot(x, y) plots real(y) against real(x).
    • plot(x, y, attributes) plots y against x using the specified attributes.
    • plot(x1, y1, x2, y2, ..., xN, yN, attributes) plots y1, y2, ..., and yN against x1, x2, ..., and xN, respectively. In this syntax, MathScript uses the specified attributes for the last plot and the default attributes for previous plots.

    Complex Inputs

    If you want to specify a complex input, use the following syntax: plot(z, attributes), where z = x + y I;

    To use the plot(x, y, attributes) syntax, you must specify real inputs. If you do not specify real inputs, MathScript replaces complex numbers with their real parts.

    X = [0:0.01:1];
    Y = X.*X;
    plot(X, Y, 'bo-')

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: Not supported

    Recently Viewed Topics