简体   繁体   中英

Efficient integral function in Matlab

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?

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

cumtrapz();

seriously CumTrapz

It computes the trapazoidal aproximation of the integral.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM