MF_spectrum MD_spectrum ME_spectrum
Functionspatial frequency spectrum
Syntax C/C++#include <MFstd.h>
void MF_spectrum( fMatrix Spec, ui htSpec, ui lenSpec, fMatrix X, ui htX, ui lenX, fMatrix Win );
C++ MatObj#include <OptiVec.h>
void matrix<T>::sprectrum( const matrix<T>& MX, const matrix<T>& MWin );
Pascal/Delphiuses MFstd;
procedure MF_spectrum( MSpec:fMatrix; htSpec, lenSpec:UIntSize; MX:fMatrix; htX, lenX:UIntSize; MWin:fMatrix );
DescriptionThe data set MX is analyzed for the mean square amplitude of its spatial frequency spectrum. The result is stored in MSpc.
Internally, the spectrum is calculated by dividing the input data into overlapping segments, similarly to the one-dimensional case described for VF_spectrum.
MWin is a window that is applied to the data segments. Three functions are available that give suitable Windows: MF_Welch,   MF_Parzen, and MF_Hann. A square window is available by setting all matrix elements equal to 1.0 (MF_equC( MWin, htWin, lenWin, 1.0 ); ), but this is not recommended.
htSpec and lenSpec must be integer powers of 2.
MSpec has [htSpec+1][lenSpec+1] elements (!), and htX >= n*htSpec, lenX >= n*lenSpec, htWin = 2*htSpec, lenWin = 2*lenSpec.

About special versions with the prefixes MFs_ and MFl_, consult chapter 4.8 of HANDBOOk.HTM.

Error handlingIf either htSpec or lenSpec is not a power of 2, VF_FFT (on which MF_spectrum relies) complains "Size must be an integer power of 2" and the program is aborted. If MSpc overwrites MX or MWin, an error message "Vectors/matrices must not be identical" is generated and the program aborted.
See alsoMF_FFT,   MF_convolve,   MF_autocorr,   MF_xcorr,   MF_filter,   chapter 12

MatrixLib Table of Contents  OptiVec home