4.0

4.0 | 2 ratings Rate this file 4 Downloads (last 30 days) File Size: 1.68 KB File ID: #21417

Integrate (wrapper for dealing with infinite bounds)

by AS

 

11 Sep 2008 (Updated 12 Sep 2008)

A wrapper for quad to deal with inf bounds.

| Watch this File

File Information
Description

A wrapper for quad (or any other integration function) to deal with infinite bounds.

This basically does the transformations for you to do improper integrals. For example, what this does is:

int(f(x), 1, inf) = int( (1/x^2) f(1/x), 0, 1)

For example, if I wanted the integral of exp(-x^2) from 0 to infinity, I would just enter:
integrate(@(x)exp(-x.^2),0,inf)

And this function would do the rest of the work.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
improper integral, infinite bounds, integrate, integration
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
23 Jul 2009 Serge  
12 Sep 2008 John D'Errico

I was tempted to rate this lower, but it is an interesting code, transforming definite integrals over infinite domains to more manageable problems.

It fails in its help, which is poor. I found an inadequate description of the parameters. I found only limited error checks. I found no examples of use. I did find a superfluous number of %%%% symbols. The author might have spent more time on the help, and less effort holding his finger down on the % key.

The H1 line was missing. What is an H1 line? It is the very first line of the help block in your function. It enables the lookfor functionality in matlab. The author apparently has never looked closely at the help blocks for the codes that come from the MathWorks. When someone wants to remember the name of your function next year, how will they find it? They might try to use lookfor, but it will find nothing from this code.

I wanted to rate this as a 2.5.

Contact us