- 11th November 2008, 02:49 #1
## matlab integral

Hi

Could some one please tell me how to calculate the definite integral in MATLAB?

Thanks

- 11th November 2008, 02:49

- 12th November 2008, 00:09 #2

- Join Date
- Feb 2002
- Posts
- 750
- Helped
- 95 / 95
- Points
- 13,776
- Level
- 28

## integral matlab

- 12th November 2008, 00:09

- 12th November 2008, 04:50 #3
## matlab definite integral

I have found double(int(...)) really useful, but thanks.

This one is also good:

http://www.math.duke.edu/education/c.../mlabtut9.html

- 12th November 2008, 04:50

- 20th December 2008, 15:26 #4

- Join Date
- Dec 2008
- Posts
- 32
- Helped
- 0 / 0
- Points
- 1,302
- Level
- 8

## integral en matlab

for example to compute :

int(sin(2*x),0,pi/2) or int(sin(2*x),x,0,pi/2)

will compute sin2x integral on the interval of [0 pi]

or you can have integral of a function e.g:

write an M-file function myfun that computes the integrand:

function y = myfun(x)

y = 1./(x.^3-2*x-5);

Then pass @myfun, a function handle to myfun, to quad, along with the limits of integration, 0 to 2:

Q = quad(@myfun,0,2)

Q =

-0.4605

Alternatively, you can pass the integrand to quad as an anonymous function handle F:

F = @(x)1./(x.^3-2*x-5);

Q = quad(F,0,2);

by the way you can have all these by matlab help.it is so easy just open matlab help and use search tab. [/img]

- 24th January 2009, 17:28 #5

- Join Date
- Dec 2008
- Location
- Solar System
- Posts
- 24
- Helped
- 2 / 2
- Points
- 1,093
- Level
- 7

## definite integral matlab

Hi

Example : y = exp ( x^2 ) ; interval [10 20]

Answer :

syms x

int ( exp ( x^2 ) , 10 , 20 )

Hope I've helped !!

1 members found this post helpful.

- 26th May 2009, 12:20 #6
## definite integral in matlab

it gives an error that int does not work with class double. how to solve that problem?