CSV export + DFT math operation

This commit is contained in:
Jan Käberich 2020-12-11 20:28:40 +01:00
parent 79a990af47
commit 6e55eb02dd
27 changed files with 935 additions and 52 deletions

View file

@ -30,7 +30,7 @@ WindowFunction::WindowFunction(WindowFunction::Type type)
chebyshev_alpha = 5;
}
void WindowFunction::apply(std::vector<std::complex<double> > &data)
void WindowFunction::apply(std::vector<std::complex<double> > &data) const
{
unsigned int N = data.size();
for(unsigned int n = 0;n<N;n++) {
@ -38,6 +38,14 @@ void WindowFunction::apply(std::vector<std::complex<double> > &data)
}
}
void WindowFunction::reverse(std::vector<std::complex<double> > &data) const
{
unsigned int N = data.size();
for(unsigned int n = 0;n<N;n++) {
data[n] /= getFactor(n, N);
}
}
QWidget *WindowFunction::createEditor()
{
auto top = new QWidget();
@ -148,7 +156,7 @@ void WindowFunction::fromJSON(nlohmann::json j)
}
}
double WindowFunction::getFactor(unsigned int n, unsigned int N)
double WindowFunction::getFactor(unsigned int n, unsigned int N) const
{
// all formulas from https://en.wikipedia.org/wiki/Window_function
switch(type) {