Numerical integration - singularity

7 ビュー (過去 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 Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by