Investment Studio > Expressions > Functions > DSP > MEMP
| Short form: | float array[1][2]
memp(float array mem_coefficients, boolean power, float period) Returns a two-column row vector containing (by column):
|
| Long form: | float array[steps][2] memp(float array mem_coefficients, boolean power, float from_period, float period_step, integer steps) Returns a two-column array. One row per frequency step. Each row contains (by column):
|
All elements in mem_coefficients are converted to floats (with exclusion if conversion fails) and interpreted as a single, one-dimensional sequence. If the data array is two-dimensional, it's read in the usual order (i.e. row by row: left to right, top to bottom).
Periods (wavelengths) are expressed as sample counts. The shortest periodic component that can be reconstructed from a sequence of evenly sampled values is 2 (Nyqvist's theorem), so periods shorter than 2 (the Nyqvist frequency) are not meaningful.
See mem for details on MEM (Maximum Entropy Method) estimation of power spectra.
Example
Given the 1024-point sine wave with period 100 / 6 » 16.67 and amplitude 1,
_data = mop("sin()", makevector(1024, 0, 12 * PI / 100))
the expression
=memp(mem(array(_data), 10), TRUE, 16.6, 0.1, 3)
returns {{0.000868237922422802, 16.6}, {47.6442717160242, 16.7}, {0.196342165591151, 16.8}}.
This tells us the values of the 10-pole MEM estimate of the wave's power spectrum (since power = TRUE) for periods 16.6 (first row), 16.7 (second row) and 16.8 (third row).
If all we want is the value in one point, we can use the short form of memp. For instance,
=memp(mem(array(_data), 10), FALSE, 16.7)
returns {6.9025504014361, 16.7} telling us the 10-pole MEM estimate of the wave's amplitude spectrum (since power = FALSE) for period 16.7.