Double numerical integration of an Experimental data (no function)

1 回表示 (過去 30 日間)
Baris Gungordu
Baris Gungordu 2016 年 8 月 10 日
コメント済み: Star Strider 2016 年 8 月 10 日
Hi all,
I have a rectangular domain ( in x and y) and have 64 points equally distributed data points around this rectangular domain (lets call the data points as A). I have the numerical value of each point on the grid. (sizes: x = 1 x 64, y = 1 x 64, A = 8 x 8)
B = double_integration(A) dx dy.
I tried the already given solution , result = trapz(x,trapz(y,mat,1),2) , but did not get any result. (Error was, LENGTH(X) must equal the length of Y in dim 1.)
Any ideas?
Many thanks
  2 件のコメント
John D'Errico
John D'Errico 2016 年 8 月 10 日
Are the points scattered irregularly around the domain? Or are they on a regular lattice of some sort? Like an 8x8 grid?
Baris Gungordu
Baris Gungordu 2016 年 8 月 10 日
Yes the data points are arranged as 8 x 8 and I have coordinates in x and y for each point.

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

回答 (1 件)

Star Strider
Star Strider 2016 年 8 月 10 日
I would use trapz on each dimension of ‘A’:
int_1 = trapz(A);
Result = trapz(int_1)
  5 件のコメント
Baris Gungordu
Baris Gungordu 2016 年 8 月 10 日
My data is 8x8 but I changed it to 64x1 to make the trapz work.
I want to double integrate my data first respect to x and then with respect to y.
Star Strider
Star Strider 2016 年 8 月 10 日
The trapz function works very well with matrices. It considers each column of a matrix as individual vectors, and integrates them, creating a vector. The second trapz call integrates the vector. I do not know what ‘x’ and ‘y’ are with respect to ‘A’, but you can easily transpose ‘A’ to integrate with respect to each variable in order, if necessary.

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

カテゴリ

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