Answer the question
In order to leave comments, you need to log in
How to integrate (find the antiderivative) of a digital signal in C++?
There is a signal represented as an array of values, a sample rate (or period), and a timestamp. You need to integrate it. The formula as in the link doesn't help much.
Who knows how it's done?
Answer the question
In order to leave comments, you need to log in
The materiel is here vunivere.ru/work10048 It looks like what you need.
And another discrete
primitive studopedia.info/1-113131.html
class Antiderivative
{
private: //variables
//size_t isize; /// период интегрирования, TODO орраничеение периода (динамический кольцевой буффер)
float XN=0; /// накопленная сумма-первообразная
public:
void count( float in[], size_t len, float out[] ){
//X[k] - X[N] = sum(i=N,i<k)x[i];
for( size_t i=0; i<len; ++i ){
out[i] = count(in[i]);
}
}
/// считает одно значение
float count( float in ){
float ret = XN;
XN += in;
return ret;
}
};
It will not work to integrate here, since the signal is finite, but for integration, give an infinite one.
If you want to get the spectrum of a signal in the frequency domain, then you need the Fast Fourier Transform (FFT). You can start here: www.fftw.org
Many math libraries have implementations, such as the Intel Math Kernel Library.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question