1

I have a function of the form a*x + b and I want to integrate this function from 0 to t where t will be set to the values of a very large (length 100000) vector repeatedly. I used quad function in a for loop, but it takes too much time to compute the integral for each value in the vector. Is there any efficient way to implement this in Matlab?

3

Actually, you dont need to implement it yourself, you may search it by using "matlab numerical integration functions"...

First functons comes into my mind are;

```
Trapezoidal --> trapz(X,Y)
Cumulative Trapezoidal --> cumtrapz(X,Y)
Adaptive Lobatto Quadrature --> quadl
Adaptive Gauss-Kronrod Quadrature --> quadgk
Vectorized Quadrature --> quadv
```

0

cumtrapz();

seriously CumTrapz

It computes the trapazoidal aproximation of the integral.

tt + b*t for all elements t of your vector - jmhl 2012-04-04 20:49