Convolve two signals

Hello ROOT experts,

Considering a system with impulse response, I(t), and the power input to the system, P(t), how can I convolve I(t) and P(t)?

I could do this in MATLAB with y = conv(I,P), but my model exists within C++ and the ROOT framework. I’ve tried to use TF1Convolution to no avail. Reading through the ROOT documentation, the explanation doesn’t seem to finish:

“constructor from 2 function names where f1 and f2 are two functions known to ROOT if the function names are not knwon to ROOT then a corresponding”

There’s also a typo here.

Any help is appreciated,

Luke

${ROOTSYS}/tutorials/fit/fitConvolution.C

BTW. I assume the missing description should be something like: “if the function names are not knwon to ROOT then a corresponding TFormula will be tried.”

examples are also visible online: root.cern.ch/doc/master/fitConvolution_8C.html

Looking at the online example, I am wondering why there is no link to TFile.h whereas there are links for other ROOT classes.

Hello,

I understand the example, the convolution is actually done when adding the variables, as mentioned: “probability density function of the addition of two variables is the convolution of 2 dens. functions”, the rest is fitting.

I was looking for something which could take two user-defined functions, and convolve them. If I try the TFormula method, I get:

no matching function for call to 'sin’
TF1Convolution *f_conv = new TF1Convolution(sin(x),x,0.,100.,true);

TF1Convolution *f_conv = new TF1Convolution(“sin(x)”, “x”, 0., 100., true);