..Help .Objects

Delta or Derivative




Returns the difference between succesive samples or the approximate time derivative of the input signal. Absolute and digital modes are useful as detectors.

Pins
io letter name unit description
in x input auto input to be processed
out = auto difference between samples

Parameters
name option key description
mode normal n Digital will make the delta negative. Absolute will make the delta positive. See notes for derivative mode.
digital d
absolute a
derivative e
derivative
parameters
Points Sliders used only in derivative mode.
Alpha

Notes
Normal mode returns the difference between the current sample and the last sample. The output may positive or negative depnding on the input signal. Normal mode is not the same as a derivative.
Use the digital mode to detect when a signal changing. The output will be negative (true) if adjacent samples are different. Otherwise it will be zero (false).
Absolute mode does the oposite, when adjacent sample are different, the output will be positive (false). When adjacent samples are the same the output will be -0 (true).

Derivative mode aproximates the time derivative of the input signal. In a broad sense it is a high pass filter with a linear frequency reponse. At the highest frequencies however, the derivative is attenuated to zero output. The frequency at which the begins is called the roll-off frequency. This makes it possible to implement the operation in a sampled environment.

Roll-off also causes some distortion in sharp edges. For example, the derivative of a two sample wide pulse will be smeared across many samples. For this reason, if you expect to be dealing with pulses, or other sharp edges like ramp and square waves, it may be better to use the normal mode of this object.

There are two parameters used to adjust the roll-off, number of points and window alpha. These are adjusted with sliders on the popup panel.

Points tells the operation how many adjacent samples to use for the derivative calculation. This is always an odd number. Changing the number of points effects:
phenomena description
Maximum bandwidth Using more points in the calculation increases the rolloff frequency.
Latency Input signals will not appear at the output until many samples later. The exact number is 1/2 of the number points.
Accuracy Using more points can be more accurate.
CPU usage Using more points requires many more operations for the CPU.
The Alpha parameter controls the smoothness of the frequency response. Changing alpha effects:
phenomena description
Accuracy Higher values of alpha smooth the frequency response and can greatly increase the accuracy.
Bandwidth Higher values of alpha will reduce the bandwidth.

The following two graphs show the results of some combinations of alpha (α) and the number of points (C). The ideal frequency response is shown as the red dotted line.

The top chart shows the absolute frequency response.
The bottom chart shows a magnification of the predicted response subtracted from the ideal response.



The Peak and Zero indicators shown on the popup panel are two different measures of accuracy. On the popup panel they are shown in decibels, although they are really a subtraction of the predicted value from the ideal value. In the two charts below, the error is shown as the actual numeric value.

Peak is simply the frequency and amplitude of the maximum response. There will always be a peak value, regardless of the points and alpha setting.

Zero is a more useful measure of accuracy, but it is not always possible to measure it. Zero states the maximum error of the response curve and the highest frequency at wich it occurs. All input signals below the zero frequency are guaranteed to have less than the stated error.

Some expirimentaion may be needed to find suitable combinations of points and alpha. Simply setting the sliders at maximum may not produce the most accurate results. Often it is nessesary trade a lower roll-off frequency for an order of magnitude increase in accuracy.




©1999-2008 Andy J Turner
All rights reserved.