NASA
close all;
clear;
clc;
%% Taking user input
prompt = \'Enter the molecular formula of the substance\\n(Constituents can be amongst C, H, N, O and AR)\\n\';
substance = input(prompt, \'s\');
substance = upper(substance);
%% Co-efficient extraction
[co_eff, temp_range] = co_eff_extraction(substance);
if isequal(co_eff, zeros(size(co_eff)))
fprintf(\'\\nData for this substance is not available\\n\');
return;
end
%% Molecular Weight
MW = mol_wt(substance);
fprintf(\'\\nMolecular weight of %s is %d\', substance, MW);
%% Plotting
T = linspace(300,5000,1000);
j = length(T);
cp = zeros(size(T));
h = zeros(size(T));
s = zeros(size(T));
for i = 1:j
[h(i), s(i), cp(i)] = prop_cal(co_eff, T(i), temp_range);
end
figure(1);
hold on;
plot(T,h);
ylabel(\'Specific enthalpy (J/Kg)\');
xlabel(\'Temperature(K)\');
figure(2);
hold on;
plot(T,cp);
ylabel(\'Specific heat (J/Kg-K)\');
xlabel(\'Temperature(K)\');
figure(3);
hold on;
plot(T,s);
ylabel(\'Specific entropy (J/Kg-K)\');
xlabel(\'Temperature(K)\');
%% Creating folder and saving
prompt = sprintf(\'\\nDo you want to save the plots for %s {y/n)\\n\', substance);
p = input(prompt, \'s\');
p = lower(p);
if(p == \'y\')
%Creating folder
foldername = cellstr(substance);
mkdir(foldername{1});
% Saving
plotting_folder = [\'C:\\Program Files\\MATLAB\\MATLAB Production Server\\R2015a\\bin\\Parsing NASA thermodynamic data\\\',substance];
cd(plotting_folder);
figure(1);
saveas(gcf,\'h_vs_T.jpg\');
figure(2);
saveas(gcf,\'cp_vs_T.jpg\');
figure(3);
saveas(gcf,\'s_vs_T.jpg\');
cd \'C:\\Program Files\\MATLAB\\MATLAB Production Server\\R2015a\\bin\\Parsing NASA thermodynamic data\';
end