Solution
Anil answered on
Oct 06 2021
92984/HW5P2/IG_Data.txt
0.01 0.1 280
0.0125 0.125 282.5
0.015 0.15 285
0.0175 0.175 287.5
0.02 0.2 290
0.0225 0.225 292.5
0.025 0.25 295
0.0275 0.275 297.5
0.03 0.3 300
0.0325 0.325 302.5
0.035 0.35 305
0.0375 0.375 307.5
0.04 0.4 310
0.0425 0.425 312.5
0.045 0.45 315
0.0475 0.475 317.5
0.05 0.5 320
0.0525 0.525 322.5
0.055 0.55 325
0.0575 0.575 327.5
92984/HW5P2/HW5P2.asv
clear;
clc;
IG_Data = load('IG_Data.txt');
n = IG_Data(:,1);
V = IG_Data(:,2);
T = IG_Data(:, 3);
[P_IG, P_vdW, P_RK] = Ideal_Gases(n, V, T);
IG_Data_New = [IG_Data, P_IG, P_vdW, P_RK];
fileName = 'IG_Data_New.txt';
fileId = fopen(fileName,'w');
fprintf(fileId,'%.4g %.4g %.4g %.4g %.4g %.4g\n',IG_Data_New');
fclose(fileId);
star = '*******************************************************************';
das = '-----------------------------------------------------------------------------------------------';
fprintf(['%s\n' ...
'%-10s %-10s %-10s %-10s %-10s %-10s\n' ...
'%-10s %-10s %-10s %-10s %-10s %-10s\n' ...
'%s\n'], ...
star, ...
'n', 'V', 'T', 'P_IG', 'P_vdW', 'P_RK', ...
'[kmol]', '[m^3]', '[K]', '[bar]', '[bar]', '[bar]', ...
das);
fprintf('%-10.4g %-10.4g %-10.4g %-10.4g %-10.4g %-10.4g\n',IG_Data_New');
function [P_IG, P_vdW, P_RK] = Ideal_Gases(n, V, T)
R_u = 0.08314;
a = 1.368; b = 0.0367; c = 15.989; d = 0.02541;
P_IG = (n.*R_u.*T)./V;
P_vdW = (R_u*T)./(V./n - b) - a./(V./n).^2;
P_RK = (R_u*T)./(V./n - d) - c./((V./n).*(V./n + d).*T.^0.5);
end
92984/HW5P1/HW5P1.m
% HW5P1
% All function used are below in this script file
% All output are displaced with 2 decimal point.
clear;
clc;
title = input('Title: ','s');
A = input('Surface area in sq. m: ');
L = input ('Wall thickness: ');
k = input('Thermal conductivity in W/(m.K): ');
h_1 = input('Heat transfer coefficient at the inner surface in W/(m^2.k): ');
h_2 = input('Heat transfer coefficient at the outer surface in W/(m\^2.k): ');
T_inf_1 = input('The inner temperature in K: ');
T_inf_2 = input('The outer temperature in K: ');
R_conv_1 = R_Convection(h_1, A);
R_conv_2 =...