Because each DADiSP analysis window can be a mathematical combination of other windows in the Worksheet, you can use DADiSP to evaluate and plot polynomial expressions such as:
To generate a graph of the polynomial, we need to sweep x through a range of values and plot the result of this equation for each x value. You can use DADiSP to evaluate this expression with the following steps:
Generate a four-window Worksheet.
In W2, type the polynomial by substituting W1 for x:
(W1 + 1)/(W1 ^ 2 + 2 * W1 + 1)
Now, to sweep W2 through a linear range of values, generate a line in window 1:
gline(100, .01, 1.0, 0.0)
Window 2 displays the polynomial for 100 x values ranging from 0.0 to 1.0 and spaced 0.01 units apart.
To alter the number of points, spacing, or range of the sweep, just change the GLINE parameters in W1.
We could also use the variable x directly. For example:
x = -1..0.01..1;
y = (x + 1) / (x^2 + 2*x + 1);
Now the variable y contains the polynomial values ranging from –1 to 1 by an increment of 0.01.
This polynomial evaluation technique is not limited to linear sweeps. You can also evaluate polynomials with any sweep function. Because of this, DADiSP can also easily process Z-transforms. For example, consider the following single pole transform:
To evaluate this transform:
Set up the equation in window 4 by substituting W3 for z:
W4: 1/(1 - 0.5 * W3 ^ -1)
Now, set up the unit circle values in window 3:
W3: exp(w1 * 2 * pi * i)
Since window 1 sweeps from 0.0 to 1.0, window 3 now contains 100 values of the unit circle sampled 0.01 radians apart. Window 4 displays the Z-transform evaluated over the unit circle.
By calculating the IFFT of window 4, we can view the transform in the time domain:
W5: real(ifft(w4))
and window 5 contains the expected decaying exponential.