How to double integral over a non rectangular region using trapz?

I have a data containing the depth and width of a cross section, and these corresponding velocity at certain depth and width. And I would like to get the average velocity over the cross section using double integral over depth and width. But I am not sure how to do so by trapz, since the cross area is not rectangular. The data of depth, width and velocity(d,w) is like below.
depth =
0 0 0 0 0 0
0.2700 0.5400 1.0800 1.6200 2.1600 2.4300
0.2800 0.5600 1.1200 1.6800 2.2400 2.5200
0.3000 0.6000 1.2000 1.8000 2.4000 2.7000
0.3000 0.6000 1.2000 1.8000 2.4000 2.7000
0.2900 0.5800 1.1600 1.7400 2.3200 2.6100
0.2900 0.5800 1.1600 1.7400 2.3200 2.6100
0.3000 0.6000 1.2000 1.8000 2.4000 2.7000
0.2000 0.4000 0.8000 1.2000 1.6000 1.8000
0.3000 0.6000 1.2000 1.8000 2.4000 2.7000
0.3000 0.6000 1.2000 1.8000 2.4000 2.7000
0.3300 0.6600 1.3200 1.9800 2.6400 2.9700
0.3300 0.6600 1.3200 1.9800 2.6400 2.9700
0.3400 0.6800 1.3600 2.0400 2.7200 3.0600
0.3300 0.6600 1.3200 1.9800 2.6400 2.9700
0.2300 0.4600 0.9200 1.3800 1.8400 2.0700
0 0 0 0 0 0
width =
0 0 0 0 0 0
6 6 6 6 6 6
9 9 9 9 9 9
12 12 12 12 12 12
15 15 15 15 15 15
18 18 18 18 18 18
21 21 21 21 21 21
24 24 24 24 24 24
27 27 27 27 27 27
30 30 30 30 30 30
33 33 33 33 33 33
36 36 36 36 36 36
39 39 39 39 39 39
42 42 42 42 42 42
45 45 45 45 45 45
50 50 50 50 50 50
57 57 57 57 57 57
V(d,w)=
0 0 0 0 0 0
0.5200 0.5200 0.4000 0.4400 0.4000 0.6700
0.8000 0.9200 1.1200 1.4000 1.4000 1.3400
1.3700 1.7500 1.8200 1.6800 1.5300 1.4000
1.5600 2.0300 1.9800 1.8200 1.5300 1.5300
1.6800 2.3200 2.1800 2.1800 1.4000 1.6400
1.7900 2.5300 2.5800 2.2300 1.9800 1.8200
2.4200 2.6500 2.5800 2.1600 2.2300 1.9800
2.5800 3.0200 2.9600 2.7100 2.1800 2.1200
2.7700 3.0900 3.1600 2.1300 2.7100 2.3700
2.7700 3.1600 3.1600 2.8900 2.5800 2.6500
2.7100 3.0900 3.0200 2.7100 2.4700 1.9800
2.1800 2.7700 2.7700 2.6500 2.5300 2.2300
2.0800 2.4700 2.5300 2.2300 2.2300 1.3700
0.5600 0.6700 1.4600 1.3400 1.4900 1.5300
0.2800 0.3350 0.7300 0.7000 0.7450 0.7650
0 0 0 0 0 0
I am trying to do it like this
d=[0.1,0.2,0.4,0.6,0.8,0.9].*num(:,2);
for i=1:17
I1(i)=trapz(depth(i,:),velocity(i:));
end
I2=trapz(width(:,1),I1)
v_averaye=I2/Area

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

标签

提问:

2019-2-25

编辑:

2019-2-25

Community Treasure Hunt

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

Start Hunting!

Translated by