K
K
kyb2016-04-11 18:58:43
C++ / C#
kyb, 2016-04-11 18:58:43

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

2 answer(s)
K
kyb, 2016-04-11
@kyb

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;
  }
};

I quickly built a project in Qt with visualization for verification, if someone needs to find it, I'll post it.
Updated. If there is another option for integrating a signal based on an alpha-beta filter (simplified Kalman). At the end, he did it.

R
res2001, 2016-04-11
@res2001

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 question

Ask a Question

731 491 924 answers to any question