#include <spectrum.h>
Static Public Methods | |
void | spectralCalc (const double *a, const size_t N, std::vector< double > &v) |
Calculate the wavelet power spectrum from the result of the wavelet transform. More... | |
void | copyBands (double *dest, const double *src, const size_t N, size_t startBand, const size_t endBand) |
Copy wavelet coefficient bands from startBand to endBand. More... | |
Private Methods | |
spectrum () | |
This class is designed to provide static functions, not to be declared as a class instance. More... | |
~spectrum () | |
spectrum (const spectrum &rhs) |
Definition at line 8 of file spectrum.h.
|
This class is designed to provide static functions, not to be declared as a class instance.
Definition at line 12 of file spectrum.h. 00012 {} |
|
Definition at line 13 of file spectrum.h. 00013 {} |
|
Definition at line 14 of file spectrum.h. 00014 {} |
|
Copy wavelet coefficient bands from startBand to endBand. Elements in the destination array that are not copied are set to zero. Definition at line 49 of file spectrum.cpp. Referenced by main().
00054 { 00055 size_t end = 1; 00056 size_t start = 0; 00057 size_t bandCnt = 0; 00058 00059 while (end <= N) { 00060 double power = 0; 00061 for (size_t i = start; i < end; i++) { 00062 if (bandCnt >= startBand && bandCnt <= endBand) 00063 dest[i] = src[i]; 00064 else 00065 dest[i] = 0; 00066 } 00067 start = end; 00068 end = end << 1; 00069 bandCnt++; 00070 } 00071 } // copyBands |
|
Calculate the wavelet power spectrum from the result of the wavelet transform. The spectrum is calculated by calculating the power for each of the wavelet coefficient bands. The bands are ordered by increasing powers of two: 20, 21, 22... This is the unnormalized power spectrum. The normalized power spectrum for band j divides the power by 2j. Definition at line 20 of file spectrum.cpp. Referenced by main().
00023 { 00024 size_t end = 2; 00025 size_t start = 1; 00026 00027 while (end <= N) { 00028 double power = 0; 00029 for (size_t i = start; i < end; i++) { 00030 power = power + (a[i] * a[i]); 00031 } 00032 v.push_back( power ); 00033 start = end; 00034 end = end << 1; 00035 } 00036 } // spectralCalc |