The work W (kJ) produced in a piston -cylinder device can be calculated by findi
ID: 1978174 • Letter: T
Question
The work W (kJ) produced in a piston -cylinder device can be calculated by finding the integral of the curve shown in a P -V diagram and with the following equation: W = integral P dV The pressure P (kPa) in the piston -cylinder device can be calculated from the following equation: PV = nRT where P is the pressure (kPa) V is the volume (m^3) n is the number of moles (1 kmol) R is the ideal gas constant (8.314 kJ/kmol-K) T is the temperature (300 K) The volume V (m^3) of 3 different piston- cylinder devices were measured and are shown in the table below. Write a MAT LAB script or function (your choice) to apply the trapezia rule to calculate the work W produced in the piston -cylinder system as the volume changes in EACH system from the data provided. Use the appropriate output mechanism to display an output message of your choice and the work produced in each piston -cylinder system in the diary file. Solution: The work in each system is: 1.0e+03 * 4.3414 3.8568 4.1706Explanation / Answer
The MATLAB code for finding W using trapezoidal formula is given below :
------------------------------------------------------------------------------------------------------------
V1=[1.0 1.9 2.7 4.1 5.0];
V2=[1.0 2.3 3.4 4.6 5.0];
V3=[1.0 2.0 2.9 4.4 5.0];
R= 8.314;
n=1;
T=300;
P1=n*R*T*(V1.^-1);
P2=n*R*T*(V2.^-1);
P3=n*R*T*(V3.^-1);
W1=0 ; % implementing trapezoidal formula using for loop
for i=1:4
W1= W1+(P1(i)+P1(i+1))*(V1(i+1)-V1(i))/2;
end
W2=0; % implementing trapezoidal formula using for loop
for i=1:4
W2= W2+(P2(i)+P2(i+1))*(V2(i+1)-V2(i))/2;
end
W3=0 ; % implementing trapezoidal formula using for loop
for i=1:4
W3= W1+(P3(i)+P3(i+1))*(V3(i+1)-V3(i))/2;
end
fprintf(' the work done by system 1 is : %5.4f ',W1);
fprintf(' the work done by system 2 is : %5.4f ',W2);
fprintf(' the work done by system 3 is : %5.4f ',W3);
---------------------------------------------------------------------------------------------------------------------------------
The reults are
the work done by system 1 is : 4178.4426
the work done by system 2 is : 4299.7201
the work done by system 3 is : 4498.1536
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.