SBB Host
Host communication with the self balancing bike.
Loading...
Searching...
No Matches
spectra.h File Reference
#include <vector>
#include <fftw3.h>
#include <math.h>

Go to the source code of this file.

Namespaces

namespace  spectra
 A namespace providing wrappers for FFTW library.
 

Functions

std::vector< double > spectra::abs (std::vector< fftw_complex > vals)
 Compute the magnitute. More...
 
std::vector< double > spectra::abs2 (std::vector< fftw_complex > vals)
 Compute the magnitute squared. More...
 
std::vector< double > spectra::arg (std::vector< fftw_complex > vals)
 Compute the phase in radiants. More...
 
std::vector< double > spectra::argd (std::vector< fftw_complex > vals)
 Compute the phase in degrees. More...
 
void spectra::polar (std::vector< fftw_complex > vals, std::vector< double > *mag, std::vector< double > *phase)
 Compute the polar coordinates. More...
 
void spectra::polard (std::vector< fftw_complex > vals, std::vector< double > *mag, std::vector< double > *phase)
 Compute the polar coordinates. More...
 
void spectra::bode (std::vector< fftw_complex > vals, std::vector< double > *mag, std::vector< double > *phase)
 Compute the bode coordinates. More...
 
void spectra::boded (std::vector< fftw_complex > vals, std::vector< double > *mag, std::vector< double > *phase)
 Compute the bode coordinates. More...
 
std::vector< double > spectra::frequency (size_t size, double fmax=0.5)
 Compute the frequency vector. More...
 
std::vector< fftw_complex > spectra::fft (std::vector< double > vals)
 Compute the spectra. More...
 
std::vector< double > spectra::psd (std::vector< double > vals)
 Compute the power-spectra-density. More...
 

Variables

constexpr int spectra::REAL = 0
 Position of the real part in fftw_complex type. More...
 
constexpr int spectra::IMAG = 1
 Position of the imag part in fftw_complex type. More...