surface integral computation.
2 次查看(过去 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!