Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(MATLAB) understand quadl vs quadv

Tags:

math

matlab

Im trying to understand why a call like this

G = const * quadv(fun,a,b,tol)

returns different values than

lenB = length(b)
for  1 = 1:lenB
    G(i) = const .* quadl(fun,a,b,tol)
end

and how to achieve both calls to return the same values ?

EDIT: I would like to run the quadl faster for arrays as well. So I would formulate the above question:

If it is possible, how to call quadl also for arrays (similar like the quadv call above), and thus increase performance by the calculations?

like image 236
HeinrichStack Avatar asked Dec 05 '25 11:12

HeinrichStack


1 Answers

Matlab's quadl uses adaptive Lobatto quadrature; quadv uses adaptive Simpson's rule.

The quality of the answer you get might depend on the function you assume. What does your test fun look like?

I'll assume that you're passing the same function, limits, and tolerance to both calls. That will mean the differences are smaller than the tolerance.

The two methods are different - Gaussian quadrature is not the same as Simpson's rule:

http://en.wikipedia.org/wiki/Gaussian_quadrature

like image 104
duffymo Avatar answered Dec 07 '25 15:12

duffymo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!