Mu Analysis and Synthesis Toolbox    
siggen

Generate VARYING matrix functions

Syntax

Description
siggen is a general purpose signal generator. You can provide a timebase with the argument t, and the function to be evaluated with the first argument (a string), function(t). The output, y, will be a VARYING matrix. t could also be VARYING, in which case the timebase is the independent variables contained in t.

function(t) is not necessarily dependent on t. In the cases where it doesn't depend on t, siggen can be slow. This is because function is evaluated with a MATLAB eval call for every element in t. For example, consider generating a random vector. The command

generates a 1 x 1 VARYING matrix with 101 independent variables. This is very fast because it depends on t. To a 2 x 1 VARYING matrix of random values, you can use the command

This is slow because 101 evaluations of rand(2,1) are performed in a MATLAB for loop. For vectors of random signals, a much faster alternative is to use vpck with a random matrix of the appropriate size. In the above example this would be

Examples
The first example illustrates what is perhaps the most common use of siggen. A single-input single-output signal is created from MATLAB mathematical functions. It is important to use t as the independent variable in the function string.

The second example illustrates that the second argument can make use of the independent values of a VARYING matrix. Note also that the specified function is independent of t, and is executed at each instance of t. This example is included to illustrate that the function string need not depend on t. In practice the string rand(size(t)) is orders of magnitude faster than rand.

The use of siggen is not restricted to single-input, single-output signals. The following example creates a 2 x 2 VARYING matrix. In this example the matrix elements are all functions of t and the results plotted in the figure. They could equally well have all been independent of t, for example 'rand(3,2)' could be the function string. (Note that they must all be one type or the other (this restriction does not apply if t is a single number).

siggen cannot generate stair-step signals with user-specified values. You can do this however (for single-input/single-output signals) using the command vpck or the µ-Tools commmand step_tr. Vectors of signals can be created with vpck and abv. The following example demonstrates the use of vpck. vinterp is used to plot a meaningful representation of the signal.

See Also
cos_tr, sin_tr, step_tr, vpck, vinterp



sel, reordsys simgui