summaryrefslogtreecommitdiff
path: root/3843/CH11/EX11.2/Ex11_2.sce
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /3843/CH11/EX11.2/Ex11_2.sce
parentb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff)
downloadScilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip
initial commit / add all books
Diffstat (limited to '3843/CH11/EX11.2/Ex11_2.sce')
-rw-r--r--3843/CH11/EX11.2/Ex11_2.sce22
1 files changed, 22 insertions, 0 deletions
diff --git a/3843/CH11/EX11.2/Ex11_2.sce b/3843/CH11/EX11.2/Ex11_2.sce
new file mode 100644
index 000000000..a3e760804
--- /dev/null
+++ b/3843/CH11/EX11.2/Ex11_2.sce
@@ -0,0 +1,22 @@
+// Example 11_2
+clc;funcprot(0);
+// Given data
+T=25;// °C
+P=2;// MPa
+m_1=2;// The mass of nitrogen in kg
+m_2=4;// The mass of CO_2 in kg
+M_1=28;// The molecular weight of the nitrogen in kg/k.mol
+M_2=44;// The molecular weight of the CO_2 in kg/k.mol
+Rbar=8.314;// The universal gas constant kJ/kmol.K
+
+// Calculation
+N_1=m_1/M_1;// The number of moles for nitrogen in mol
+N_2=m_2/M_2;// The number of moles for CO_2 in mol
+N=N_1+N_2;// The total number of moles in mol
+y_1=N_1/N;// The mole fraction for nitrogen
+y_2=N_2/N;// The mole fraction for CO_2
+P_1=y_1*P;// The partial pressure for nitrogen in MPa
+P_2=y_2*P;// The partial pressure for CO_2 in MPa
+M=(M_1*y_1)+(M_2*y_2);// The molecular weight of the mixture in kg/k.mol
+R=Rbar/M;// The gas constant of the mixture in kJ/kg.K
+printf("\nThe partial pressure for nitrogen,P_1=%0.2f MPa \nThe partial pressure for CO_2,P_2=%1.2f MPa \nThe gas constant of the mixture,R=%0.3f kJ/kg.K",P_1,P_2,R);