blob: f3fa8137bf997545f8bfa2ef89f5a7fc933a6c84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
clc
P1=500 //initial pressure of gas in kPa
V1=0.2 //initial volume of gas in metre cube
P2=100 //final pressure of gas in kPa
gama=1.4 //Cp/Cv ratio of gas
W=P1*V1*log(P1/P2)//work done when volume inversely proportional to pressure
mprintf("W=%fkJ\n",W)//ans may vary due to round off error
V2=((P1*(V1^gama))/P2)^(1/gama)//final volume
mprintf("V2=%fmetre-cube\n",V2)//ans may vary due to roundoff error
W=(P2*V2-P1*V1)/(1-gama)//work done when PV^γ is constant
mprintf("W=%fkJ",W)//ans may vary due to roundoff error
|