4
$\begingroup$

I have the following integral

$$\int_{-\infty}^{\infty} g(t-\tau) \, \mathrm d\tau$$

where $g(\cdot)$ is a known function, e.g., $g(t) = \sin(t)$, and I want to evaluate its value with MATLAB. How should I do this in discrete form? Thanks.

$\endgroup$
1
  • 3
    $\begingroup$ But in your example, $\int_{-\infty}^{\infty}\sin(t-\tau)d\tau$ does not exist. $\endgroup$
    – msm
    Commented Jun 16, 2017 at 19:35

1 Answer 1

6
$\begingroup$

Use integral function.

q = integral(g,xmin,xmax)

For example $g(t) = e^{-t}$

$$q = \int_0^{\infty}e^{-t}\mathrm{d}t = 1$$

g = @(t) exp(-t);
q = integral(g,0,Inf)

More information Matlab numerical integration

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.