フィルターのクリア

Surface integral calculation over a segment defined by two points

5 ビュー (過去 30 日間)
Riccardo Giaffreda
Riccardo Giaffreda 2020 年 1 月 23 日
回答済み: Walter Roberson 2020 年 1 月 24 日
Hello, I have generated two vectors x=y=[-50:50] then a map with the meshgrid command. Then I have generated some random points that I have interpolated with command griddata in order to get the z values in corrispondace of the coordinates x,y of the map. My problem is that, given two points x1,y1 and x2,y2 I want to calculate the sum of the z values I get over the segment defined by this two points. Since it might be that the segment goes over points that are not pure integer I cannot do it..(I do not have a shape that I can describe in close form).. How can I solve the problem?

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 1 月 24 日
Xq=linspace x1 to x2 and Yq=linspace y1 to y2, using the same number of steps. Now use those as the query locations in an interp2 call.
sqrt((X2-X1)^2 + (Y2-Y1)^2) / number of steps
to get the distance between adjacent points which you need as the second parameter to trapz() to estimate the area.

カテゴリ

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