How can I integrate several functions in a single call to the QUAD or QUADL functions?

1 view (last 30 days)
I would like to integrate the functions "f1(t)", "f2(t)", and "f3(t)" each over the interval "t = (0, 1)" using the QUAD function.
f1.m, f2.m, and f3.m over the same interval. Can I write a function that returns a 3-by-n matrix, whose first, second, and third rows are the values of "f1", "f2", and "f3", respectivelys and pass this function to QUADL?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 14 Oct 2022
Edited: MathWorks Support Team on 31 Oct 2022
This enhancement has been made for Release 14 (R14). For previous product releases, please read below for any possible workarounds:
The QUADV function introduced in MATLAB 7.0 (R14) performs vectorized quadrature. Create a function that returns a vector value where the first, second and third rows represent the evaluations of "f1", "f2", and "f3", respectively. For more details on how this function works, including an example of how to use this function, see the documentation at:
The QUAD and QUADL functions do not support this type of operation. You must evaluate these integrals using seperate calls to QUAD or QUADL.

More Answers (0)

Products


Release

R13SP1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!