Plot engine cycle with all the curves from given data
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have calculated values of p [Pa] and V [m^3] for all for points of the cycle, as well as polytropic exponents for compression and expansion.
I need to plot a diagram, I manage to plot single points, but I need also all the curves, which I fail to do.
% Given data
V1 = 0.007; % m^3
V2 = 9.66e-5; % m^3
V3 = V2;
V4 = V1;
p1 = 101325; % Pa
p2 = 1.82e6; % Pa
p3 = 4.58e6; % Pa
p4 = 309210; % Pa
nk = 1.35; % Polytropic exponent for compression 1-2
ne = 1.26; % Polytropic exponent for expansion 3-4
1 commentaire
Dyuman Joshi
le 17 Oct 2023
Modifié(e) : Dyuman Joshi
le 8 Jan 2024
Are you sure the data is correct?
Given two points for the same polytropic process, they should follow the relation P*V^k = constant. That is not the case here though -
V1 = 0.007; % m^3
V2 = 9.66e-5; % m^3
V3 = V2;
V4 = V1;
p1 = 101325; % Pa
p2 = 1.82e6; % Pa
p3 = 4.58e6; % Pa
p4 = 309210; % Pa
nk = 1.35; % Polytropic exponent for compression 1-2
ne = 1.26; % Polytropic exponent for expansion 3-4
[p1*V1^nk p2*V2^nk]
[p3*V3^ne p4*V4^ne]
scatter([V1 V2 V3 V4],[p1 p2 p3 p4],'filled')
xlabel('Volume')
ylabel('Pressure')
Réponses (1)
SOUMNATH PAUL
le 8 Jan 2024
Hi,
I understand that you need help in plotting an engine cycle, although the data you provided is not consistent with the equation P*V^k = constant, you can follow the below mentioned code for a reference on how to proceed further:
% Given data
V1 = 0.007; % m^3
V2 = 9.66e-5; % m^3
V3 = V2; % m^3
V4 = V1; % m^3
p1 = 101325; % Pa
p2 = 1.82e6; % Pa
p3 = 4.58e6; % Pa
p4 = 309210; % Pa
nk = 1.35; % Polytropic exponent for compression 1-2
ne = 1.26; % Polytropic exponent for expansion 3-4
% Calculate constants for polytropic processes
Ck = p1 * V1^nk; % Constant for compression
Ce = p3 * V3^ne; % Constant for expansion
% Generate volumes for the compression and expansion curves
V_compression = linspace(V1, V2, 100);
V_expansion = linspace(V3, V4, 100);
% Calculate the pressures for the compression and expansion curves
p_compression = Ck ./ V_compression.^nk;
p_expansion = Ce ./ V_expansion.^ne;
% Plot the engine cycle
figure;
hold on;
% Plot the compression and expansion curves
plot(V_compression, p_compression, 'b', 'LineWidth', 2); % Compression curve
plot(V_expansion, p_expansion, 'r', 'LineWidth', 2); % Expansion curve
% Plot the constant volume process (2-3 and 4-1)
plot([V2, V3], [p2, p3], 'g', 'LineWidth', 2); % Constant volume heat addition
plot([V4, V1], [p4, p1], 'g', 'LineWidth', 2); % Constant volume heat rejection
% Plot the points
plot(V1, p1, 'ko', 'MarkerFaceColor', 'k');
plot(V2, p2, 'ko', 'MarkerFaceColor', 'k');
plot(V3, p3, 'ko', 'MarkerFaceColor', 'k');
plot(V4, p4, 'ko', 'MarkerFaceColor', 'k');
% Label the points
text(V1, p1, '1', 'VerticalAlignment', 'bottom', 'HorizontalAlignment', 'right');
text(V2, p2, '2', 'VerticalAlignment', 'top', 'HorizontalAlignment', 'left');
text(V3, p3, '3', 'VerticalAlignment', 'top', 'HorizontalAlignment', 'left');
text(V4, p4, '4', 'VerticalAlignment', 'bottom', 'HorizontalAlignment', 'right');
% Set the graph labels and title
xlabel('Volume (m^3)');
ylabel('Pressure (Pa)');
title('p-V Diagram of the Engine Cycle');
% Set the axis limits
xlim([min([V1, V2, V3, V4]) * 0.9, max([V1, V2, V3, V4]) * 1.1]);
ylim([min([p1, p2, p3, p4]) * 0.9, max([p1, p2, p3, p4]) * 1.1]);
% Add a grid for better readability
grid on;
hold off;
Hope it helps!
Regards,
Soumnath.
1 commentaire
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!