Efficient integral function in Matlab

Go To StackoverFlow.com

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?

2012-04-04 20:42
by ipman
Doesn't this boil down to computing 1/2 * att + b*t for all elements t of your vector - jmhl 2012-04-04 20:49


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
2012-04-04 20:51
by Semih Ozmen


0

cumtrapz();

seriously CumTrapz

It computes the trapazoidal aproximation of the integral.

2012-04-04 20:47
by Adam Hess
Ads