Integrate pressure over area, from dataset points

5 ビュー (過去 30 日間)
Francesco Brescia
Francesco Brescia 2023 年 10 月 30 日
コメント済み: Francesco Brescia 2023 年 11 月 2 日
Hi, i want to compute the integral over the area of the pressure distribution p(x,y). I have vectors x and y ,say each one of size n by 1,containing the coordinates at which the pressure is known, and a vector of pressures, size n by 1, with the pressure at each coordinate. I thought i could use trapz 2 times to compute the integral first in one direction and then the other, but to do this i would need a Matrix of pressure, instead i have a vector of the same size of the coordinates x and y. I also know that the area I have is an anulus surface, as i can see from plotting using stem3(x,y,p). The coordinates are taken w.r.t the center of the anulus, in cartesian coordinates. Hope you can help me figure this out, thanks.
  5 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 10 月 31 日
Why not just sum the discrete values of Pressure-force at each point?
Torsten
Torsten 2023 年 10 月 31 日
編集済み: Torsten 2023 年 10 月 31 日
If your suggestion was used, the density of the measurement points had to mirror the areas associated with them. But imagine data accumulating in a certain area while in another, there are almost no measurements. In this case, the weights for the datapoints in the integration couldn't be equally chosen.

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

採用された回答

Torsten
Torsten 2023 年 10 月 30 日
編集済み: Torsten 2023 年 10 月 30 日
Maybe you want to get mean pressure over the face. In this case, divide "sol" by area = pi*(5^2-1^2) as done below.
x = load("x.mat")
x = struct with fields:
x1: [1323×1 double]
y = load("y.mat")
y = struct with fields:
y1: [1323×1 double]
p = load("p.mat")
p = struct with fields:
p: [1323×1 double]
plot(x.x1,y.y1,'o')
F = scatteredInterpolant(x.x1,y.y1,p.p);
fun = @(r,theta)F(r.*cos(theta),r.*sin(theta)).*r;
sol = integral2(fun,1,5,0,2*pi)
Warning: Reached the maximum number of function evaluations (10000). The result fails the global error test.
sol = 37.9349
mean_sol = sol/(pi*(5^2-1^2))
mean_sol = 0.5031
  5 件のコメント
Torsten
Torsten 2023 年 11 月 1 日
編集済み: Torsten 2023 年 11 月 1 日
Study the example
Multiple Numerical Integrations
under
to learn about the necessary format of your function data in order to use "trapz" for a 2d integration.
If you have problems to make your data compatible with the required format for "trapz", use the "scatteredInterpolant" approach - the setup is easy and the results won't differ significantly in my opinion.
Francesco Brescia
Francesco Brescia 2023 年 11 月 2 日
Thank you very much for the help Torsten, I'll have a better look at trapz.

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

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