In: Other
A bicycle rider is interested in the effects of temperature on air density. A change in temperature will also affect the tire pressure.
a) Write a computer program that calculates air density at atmospheric pressure for temperatures from -10?C to 50?C.
b) Assume that a bicycle tire is inflated to an absolute pressure of 450 kPa at 20?C. Assume also that the volume of the tire does not change with temperature. Write a program to show how the tire pressure changes with the temperature in the same range, -10?C to 50?C.
Prepare a table or graph or both.
MATLAB is used
Ideal gas equation;
A) MATLAB Script
%Universal gas constant
R = 8.314;
%Formula: density = Pressure x Molar mass / R / T
%Atmosphere pressure in Pascals
P = 101325 ;
%Array for temperature in celsius between -10 and 50
Tc = [-10;-5;0;5;10;15;20;25;30;35;40;45;50];
%Temperature in Kelvin
T = Tc + 273.15;
%Molar mass of 0.0289 kg/mol
M = 0.0289;
%Density in kg/m^3
d = (P*M/R)./T;
y(:,1)=Tc;
y(:,2)=d;
y
plot(Tc,d)
xlabel('Temperature in Celsius')
ylabel('Density in kg/m^3')
title('Graph showing variation of density with temp')
----
Result:
This is the table (Temp and density) along with the graph
B) Script
%At constant volume
%Pv = RT
%Thus, p1/p2 = T1/T2
%Initial pressure in kPa
P_initial = 450;
%Initial temp in celsius
Tc_initial = 20;
%Initial temp in K
T_initial = Tc_initial + 273.15;
%Making an array of temp in celsius
Tc = [-10;-5;0;5;10;15;20;25;30;35;40;45;50];
%Converting celsius to K
T = Tc + 273.15;
%Command to calculating pressure
P = (P_initial/T_initial)*T;
%Storing temp and pressure values in one array
y(:,1)=Tc;
y(:,2)=P;
y
plot(Tc,P)
xlabel('Temperature in Celsius')
ylabel('Pressure in kPa')
title('Variation of pressure inside tyre with temperature')
----
Result:
Both table ( y has first column as temperature in C and second column as Pressure in kPa) and graph are shown.
----
MATLAB is the best coding language for a chemical engineer. Hope the solutions helped you. For any doubts, please leave a comment. Also, if you liked the solution, please give a positive review. It would really be helpful.