The work W kJ produced in a piston cylinder device can be ca
Solution
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

