Go to the previous, next section.

How do I define variables, and how can I use them?

Scalar variables are defined with the define command. As mentioned above, vectors are defined with the set command. A variable may be a number, or a character string. You may use them in any SM command, by preceding the name of the variable with a $. For example:

        define 2PI 6.283
        set x=1,100
        do i = 0, 2, .01 {
           set x[$i] = $i * $2PI
        }
        set i=0, 2 , .01 set x=$2PI*i
        set y = sin(x)
        limits x y
        box
        define xlab {my signal2
        xlabel $xlab
        ylabel sine

Go to the previous, next section.