Main Content

Generate Test Signals

In the Test Sequence block, you can generate signals to use for testing. First, define an output data symbol using the Data Symbols pane, and then use that output name with a signal generation function in a test step. For information on adding symbols, see Manage Input, Output, and Data Objects. For an example that shows how to implement signal functions in a Test Sequence block, see Sinusoidal and Random Number Functions in Test Sequences

Signal Generation Functions

You can these functions in the Test Sequence block to create test signals, random number values, and natural exponents. You can use temporal operators with some signal generation functions. For more information, see Temporal Operators.

Note

Scaling, rounding, and other approximations of argument values can affect function outputs.

FunctionDescription
sin

Returns the sine of the input in radians.

cos

Returns the cosine of the input argument in radians.

square

Generates a square wave test signal.

sawtooth

Generates a sawtooth wave test signal.

triangle

Generates a triangle wave test signal

ramp

Returns the value of the input.

heaviside

Returns 0 when the input is less than or equal to 0, and otherwise returns 1.

exp

Returns the natural exponential function, ex.

rand

Returns uniformly distributed pseudorandom values.

randn

Returns normally distributed pseudorandom values.

latch

Saves the value of the input and returns the saved value. Resets the saved value when the step exits and reevaluates when the step is next active.

Sinusoidal and Random Number Functions in Test Sequences

This example shows how to produce a sine and a random number test signal in a Test Sequence block.

If you recreate this test sequence, before running it, set the nr symbol size and type. Hover over the nr symbol and click its Edit icon to open the Data Inspector. Set the Size to 1 and the Type to double.

The step Sine outputs a sine wave with a period of 10 seconds, specified by the argument et*2*pi/10. The step Random outputs a random number in the interval -0.5 to 0.5.

The test sequence produces signal sg.

See Also

|

Topics