User manual

3.4. SYSTEM RESPONSE FUNCTIONS 85
3.4 System Response Functions
3.4.1 Creating Time Domain Signals
The Signal Analysis Module contains several functions which are useful for building time
domain signals: gcos and gsin.Xยตprovides gstep for the creation of stair-step signals.
The example below illustrates the generation of a sine wave and a step function.
# A unit step over 10 seconds
time = 0:10:.1
y1 = gstep(time)
# multiple steps over 10 seconds
sdata = [1;-2;4]
tdata = [3;5;7]
y2 = gstep(time,tdata,sdata)
# Freq: 2 Hz, Ampl: 0.5
y3 = 0.5*gsin(time,2)
Because of the native pdm data type, and the ease in which pdms can be augmented,
vector (or even matrix) valued signals are easily created. For example:
# A function depending on t
time = 0:10:.1
y1 = pdm(exp(0.1*time),time) - gsin(time,3/(2*pi))
# A function independent of t
y2 = uniform(time)
#A2x2pdm
pt = pdm(time,time)
y3 = [pt/max(time),2*Cos(3*pt+0.2));...
2+Sin(2*pt),sqrt(pt)+0.3*random(pt)]
3.4.2 Dynamic System Time Responses
In Xmath time responses can be calculated by simply multiplying a Dynamic System
by a pdm. A zero-order hold equivalent is used with the sampling interval set to the