summaryrefslogtreecommitdiff
path: root/2870/CH4/EX4.4/Ex4_4.sce
blob: 07406eca63e42562922f91541fb97972ea6579a5 (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
clc;clear;
//Example 4.4

//given data
V1=0.05;
P1=200;
k=150;
A=0.25;

//calculations

//Part - a
V2=2*V1;
x2=(V2-V1)/A;//displacement of spring
F=k*x2;//compression force
P2=P1+F/A;//additional pressure is equivalent the compression of spring
disp(P2,'the final pressure inside the cylinder in kPa');

//Part - b
//work done is equivalent to the area of the P-V curve of Fig 4-10
W=(P1+P2)/2*(V2-V1);//area of trapezoid = 1/2 * sum of parallel sides * dist. b/w them
disp(W,'the total work done by the gas in kJ');

//Part - c
x1=0;//intial compression of spring
Wsp=0.5*k*(x2^2-x1^2);
disp(Wsp,'the fraction of this work done against the spring to compress it in kJ')