Trapezoidal integration for pressure
조회 수: 14 (최근 30일)
이전 댓글 표시
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(:)]
trapz(Streamline1)
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!
댓글 수: 0
답변 (1개)
Alan Stevens
2021년 8월 7일
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);
% figure(1)
% plot(s,P,'o-'),grid
% xlabel('s'),ylabel('P')
pressure = @(S) interp1(s,P,S);
dS = (max(s)-min(s))/100;
S = min(s):dS:max(s);
p = pressure(S);
% figure(2)
% plot(S,p),grid
I = trapz(p)*dS;
disp(I)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!