blob: 44a5d31708cb98a023f580e48f801b97291c1291 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Theory and Problems of Thermodynamics
// Chapter 1
// Basic Concepts
// Example 13
clear ;clc;
//Given data
V2_1 = 2 //ratio V2 and V1 volumes
V3_2 = 2 //ratio V3 and V2 volumes
P1 = 1 //initial pressure in MPa
T1 = 300 //initial temperature in kelvin
R = 8.314 //gas constant J/K/mol
//Calculate work done by gas
// At constant pressure process
// W1 = integrate('P1','V',1,2) = P1*(V2-V1) = P1*V1
W1 = R*T1
// V2/T2 = V1/T1 => T2 = T1*V2/V1
T2 = 2 * T1 //Temperature after heating till expansion of V2
// At constant temperature process
// W2 = integrate('P','V',1,2) = integrate('R*T/V','V',2,3) = R*T2*log(V3/V2)
W2 = R*T2*log(V3_2)
W = (W1 + W2)/1000 //Total work done in kJ
// Results
mprintf('Work done by gas = %5.3f kJ', W)
|