surface integral computation.
조회 수: 4 (최근 30일)
이전 댓글 표시
hi, i am trying to calculate a surface integral [integral(integrand*da), where da is in spherical coordinates- r^2*sin(thetha)dthetha*dfi] numericly with the dblquad function. the function is the EM field poynting vector- E cross B.
to see that it can perform the integral well, i tried to calculate a surface integral of a constant vector and it did not produce the result zero, so i figure that using dblquad might not be a good way to approach this. ?
댓글 수: 0
답변 (1개)
Mike Hosea
2012년 5월 11일
You should never expect an exact result from a numerical integrator. Even when there is no discretization error, there can be some roundoff error. Nevertheless, DBLQUAD is obsolete. Try INTEGRAL2, or if you don't have R2012a, QUAD2D.
댓글 수: 2
Mike Hosea
2012년 5월 14일
You can increase MaxFunEvals to anything you like, e.g. quad2d(...,'MaxFunEvals',10000). However, the convergence problems will still occur if you have discontinuities in the interior of the region. To deal with that, break the integral up into multiple pieces such that the discontinuities are always on the boundaries of subintegrals. If you still have convergence problems after that, you may have a singularity that is too strong for the code to handle. Sometimes loosening the tolerances may help, e.g. quad2d(...,'AbsTol',1e-3,'reltol',1e-3), but in such cases you may be able to keep the default tolerances and increase 'MaxFunEvals' instead. If you need to increase 'MaxFunEvals' and then are successful, please let me know what value of 'MaxFunEvals' you needed. We simplified a little when we introduced INTEGRAL2 and didn't include a similar parameter, instead setting it to a fixed 10000 internally for the 'tiled' method. You can always split an integral to overcome that limitation, but increasing a parameter is less work.
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!