Numerical integration - singularity

조회 수: 5 (최근 30일)
Msimon q
Msimon q 2021년 7월 12일
댓글: David Goodmanson 2021년 7월 16일
I have discrete datas of a function and I would like to evaluate its integral. I can produce infinite number of points for my function. I attach the plot of the function here.
I used two approaches. First i used "trapz" function and secondly I used "griddedInterpolant" or "interp1" with "spline" and "cubic" methods to be able to use the quadgk and Integral function(I used absError and relError as well). Both of these approaches produce significant error, and it does not matter if I use 10k or 10million points, the error is the same!
someone suggested to use vpa, but if drastically reduces speed and even with 10k points the error did not reduce.
Also when i use vpaintegral instead of integral, i get the error about using wrong arguments.
When I do the same for a function smoother than this one, my code works and the error is less (compared to analytical result) so i am nearly sure that my code is correct and the problem is related to the shape of this function
I would appreciate any help.
  댓글 수: 2
David Hill
David Hill 2021년 7월 14일
Based on the graph, it should not be a time consuming integration. Provide your code.
David Goodmanson
David Goodmanson 2021년 7월 16일
Hi MQ,
Could you provide the function that produces the singularity? From the plot, the function does not look all that singular.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by