![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1722901/image.png)
calulate the indicated mean pressure with a p-v diagramm
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I have to calculate the indicated mean pressure. I have a p-v diagramm (in the attachements). I separated the two areas by finding the intersection. But know im not sure if the polyarea() function is the correct function to calculate the two areas.
The integral i have to implement is also in the attachements
(p: pressure in the cylinder; A: piston surface; V: volume of the cylinder; s: piston travel (path) as a function of the crank angle
Thanks for help!
0 个评论
采纳的回答
Mathieu NOE
2024-6-26
编辑:Mathieu NOE
2024-6-28
hello Julian
yes you can use polyarea, I believe you could also with trapz like in my example below (it uses this Fex submission : Fast and Robust Self-Intersections - File Exchange - MATLAB Central (mathworks.com))
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1722901/image.png)
results (two loops area) :
area = 71.3220 125.0467 (with trapz)
area2 = 72.5056 125.3691 (with polyarea)
code :
load('data.mat')
[x0,y0,segments]=selfintersect(x,y); % fex : https://fr.mathworks.com/matlabcentral/fileexchange/13351-fast-and-robust-self-intersections
figure(1)
plot(x,y,'b',x0,y0,'dr','markersize',15);
axis square
hold on
% compute area for each loop
for k = 1:numel(x0)
ind = (segments(k,1):segments(k,2));
x_tmp = x(ind);
y_tmp = y(ind);
% compute area
area(k) = trapz(x_tmp,y_tmp);
area2(k) = polyarea(x_tmp,y_tmp);
plot(x_tmp,y_tmp)
end
area
area2
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!