File Exchange

image thumbnail

quad_M;quadl_M

version 1.0.0.0 (5.6 KB) by Mischa Tolsma
numerical integration with vector arguments

1 Download

Updated 25 Jan 2002

No License

Quad_M and Quadl_M are speed optimized versions of Quad and Quadl that accept vector arguments (not vector integration limits, like quadg).

Possible usage: Numerical integration of a inverse Fourier transform over a given frequency range at several points in time.

Note: matrix arguments can be used when they are transformed into vectors.

Speed up factor ~100

Cite As

Mischa Tolsma (2020). quad_M;quadl_M (https://www.mathworks.com/matlabcentral/fileexchange/1260-quad_m-quadl_m), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

Eric Wade

I seem to get errors with this ....

> [q,f] = quad_M(c4,100,100)
??? Error using ==> fcnchk
FUN must be a function, a valid string expression,
or an inline function object.

Error in ==> quad_M at 83
f = fcnchk(funfcn);

I thought it could take vectors ... ?

Jaime Aviles

Yaguang Yang

I know the following integration equals one
(this function is a normal distribution).

function y = pa22(w)
w0=1216.1;
sigma=25;
e=sqrt(sigma)*((2/pi)^(0.25))*exp(-(sigma^2)*((w0+w).^2));
dedw=-2*sigma^2*(w0+w).*e;

a11=a(1)*sin((w0+w)/2)+a(2)*cos((w0+w)/2);
a12=a(1)*cos((w0+w)/2)-a(2)*sin((w0+w)/2);
a22=a11;
y=e.^2;

Unfortunately MATLAB code
quad(@pa11,-1217,-1215)
gives 1.1534e-005!
I give a rating at least 4 because
quad_M(@pa11,-1217,-1215) gives correct
anwser!

Kevin Song

I tried this file and it is really fast. However when I use the file for integration with very small values, say bit error rate in terms of 10^(-7) for example, the program will give a extremely small value (say 10^(-100)) which is not the desired answer. Except that, it is a perfect tool.

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: quadvgk

Community Treasure Hunt

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

Start Hunting!