evaluating double integral iteratively
Show older comments
I am trying to discretize a kernel K(x,t) for solving an integral equation. I need to implement
for i=1...N
for j=1..N
a(i,j) = Int1 Int2 K(x,t)dx dt
where Int1 has limits i/N to (i+1)/N and Int2 has limits j/N to (j+1)/N
I tried the symbolic computation but it takes a lot of time. I want to use the numerical computation and speed it up. thanks
Answers (1)
Star Strider
on 14 Jul 2014
0 votes
If K(x,t) is a function, you can use integral2.
2 Comments
R yan
on 14 Jul 2014
Star Strider
on 14 Jul 2014
My pleasure!
That’s my understanding of how integral2 works. See the More About in the documentation, and its friends (linked to at the end of the page). Note that only integral can take array-valued functions, so if K(x,t) in one such, you’ll have to nest calls to integral. If it’s scalar-valued, the integral functions will be happy and will return a scalar.
Categories
Find more on Numerical Integration and Differentiation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!