Trapezoidal integration for pressure
11 views (last 30 days)
Hi guys, I have a set of streamlines made up from coordinates in the z-x axis like in the picture shown. Each blue line represents a separate streamline made up of coordinates in z and x. Along each of these streamlines I know the exact coordinates and also the pressure at each corresponding z-x and coordinate. Hence for each streamline I have a seperate matrix made up of the columns z, x and pressure. I need to now integrate the pressure distribution across the surface using the 'composite trapezoid rule' however i'm having no luck in this. An example of one of the streamline matrices is like so, in which i've tried to use the trapz function but the surface pressure is very wrong.
x = [0.025 0.0233 0.0243 0.02477 0.0254]
z = [0.3658 0.3722 0.3991 0.433 0.477]
P = [24460 24690 25005 25101 25512]
Streamline1 = [x(:) z(:) P(:)]
this is just a small segment of one of the streamlines, and i have 31 of them. Is there a way i can integrate each streamline to find the pressure distribution across every streamline, so i can then calculate the pressure across the entire surface? The fact that the streamlines are changing in both the z and x axis make the integration even more confusing for me. Any help would greatly be appreciated, thanks!
Alan Stevens on 7 Aug 2021
Do you mean something like this?
x = [0.025 0.0233 0.0243 0.02477 0.0254];
z = [0.3658 0.3722 0.3991 0.433 0.477];
P = [24460 24690 25005 25101 25512];
% Streamline coordinates
s = sqrt(x.^2 + z.^2);
pressure = @(S) interp1(s,P,S);
dS = (max(s)-min(s))/100;
S = min(s):dS:max(s);
p = pressure(S);
I = trapz(p)*dS;