Numerical Integration of 2D Unstructured Data

2 ビュー (過去 30 日間)
Uche Agbogwu
Uche Agbogwu 2022 年 6 月 8 日
回答済み: Uche Agbogwu 2023 年 2 月 15 日
Hi, I assume this is a question that has multiple answers, but I seem to not be searching correctly.
  • i have a solution to a 2D problem on an unstructured grid (grid shown below)
  • the results are stored in an (nx*ny,1) vector. i.e I have (x, y, f(x,y)) as a [nx*ny,3] vector
  • I need to integrate over the domain. I am aware of the trapz approach for 2D cases, but in my experience so far, this only works if the grid is cartesian (i.e there are nx unique values of x and ny unique values of y).
  • I tried some other suggestion to: fit the data to scatteredInterpolant, create an inline function, then use integral2, but this takes a lot of time and I need to repeat this for about 13000 data points. (about 15 seconds, so I will ne needing about 2 days for this)
  • is there any way I can speed this up (I have tried reducing the absolute and relative error settings, to arrive at this new 15 seconds time)
  2 件のコメント
Torsten
Torsten 2022 年 6 月 9 日
I always sum over the area of the triangle multiplied by the (approximated) value of the function in its center of gravity (in your case maybe the arithmetic mean of the values in the corner points).
Uche Agbogwu
Uche Agbogwu 2022 年 6 月 9 日
okay then, thank you I will give this a try.

サインインしてコメントする。

採用された回答

Uche Agbogwu
Uche Agbogwu 2023 年 2 月 15 日
My solution was to :
  • check the interpolation approach; I realised from the surfaceinterpolant object, some data points were being extrapolated to unphysical values, so I changed this to "none" and added an extra line which removed the nan objects

その他の回答 (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