Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I wrote a piece of MATLAB code to compute a double integral of the form:

[tex]

\int_{a}^{b}\int_{c}^{d}f(x,y)dxdy

[/tex]

I went about it using the trapezium rule, so what I did was apply the rule to the [itex]x[/itex] variable first to obtain:

[tex]

\int_{a}^{b}\int_{c}^{d}f(x,y)dxdy\approx\frac{\delta x}{2}\int_{c}^{d}2\sum_{i=1}^{N}f(x_{i},y)-f(a,y)-f(b,y)dy

[/tex]

I then went on to apply the trapezium rule in the [itex]y[/itex] variable to obtain:

[tex]

\begin{array}{rcl}

\int_{a}^{b}\int_{c}^{d}f(x,y)dxdy & = & \left(\sum_{i=1}^{N}\sum_{j=1}^{M}f(x_{i},y_{j})-\frac{1}{2}\sum_{i=1}^{N}f(x_{i},c)-\frac{1}{2}\sum_{i=1}^{N}f(x_{i},d)\right)\delta x\delta y \\

& - & \frac{1}{2}\left(\sum_{j=1}^{M}f(a,y_{j})-\sum_{j=1}^{M}f(b,y_{j})\right)\delta x\delta y \\

& - & \frac{1}{2}(f(a,c)+f(b,c)+f(a,d)+f(b,d))\delta x\delta y

\end{array}

[/tex]

I tried using this to compute the inverse Fourier transform of the 2d Gaussian and I got some rather bad results.

I include the results. Not what I expected.

**Physics Forums - The Fusion of Science and Community**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Numerical computation of double integral

Loading...

Similar Threads for Numerical computation double | Date |
---|---|

I Gaussian Quadrature on a Repeated Integral | Nov 28, 2017 |

I Derivative and Numerical approach | Nov 9, 2017 |

How to compute the surface height based on normal vectors | May 12, 2015 |

Numerical computation of Oscillatory integrals | Sep 5, 2012 |

Help me compute numerically this integral | Nov 28, 2010 |

**Physics Forums - The Fusion of Science and Community**