Challenge

Project 1 - Parsing NASA thermodynamic data

The following submission include code to Parse NASA Thermodynamic data as given in CHEMKIN II format.

1. User friendly code for Parsing individual data-(Code, Output, Plot, Screenshots) follows- Display of thermodynamic data in table, Individual gas selection by code user, auto calculate gas parameters and display in table, auto generation & saving of parameter plots.

2. General extraction code for parsing complete data-(Code, Output, Plot, Screenshots) follows- Display of thermodynamic data in table, auto selection of all gas, auto calculation of gas parameters and display in table, auto generation & saving of parameter plots.

3. Citation/Reference

BY Bhavin Chaudhary

1. PARSE INDIVIDUAL DATA

1.1 CODE

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%W4 MATLAB BASIC-PARSING NASA THERMODYNAMIC DATA
%SKILL-LYNC-Bhavin Chaudhary-7 April 2022 to 14 April 2022

%OBJECTIVE 1 INDIVIDUAL CALCULATION
%To parse or read the NASA Thermodynamic data into simplified and easy to interprete data format. 

%METHODOLOGY
%1. Generate string from file (read the data)
%2. Filter or extract the individual gas data 
%3. Convert the data into table(easy to read)
%4. extract the elements and calculate the specific heat, enthalpy and entropy
%5. calculate the molecular mass of gas
%6. plot the specific heat, enthalpy,and entropy w.r.t temperature 


%CITATION
%Understanding the data structure
%1.Understanding the NASA Thermodynamic data formatting method- pdf link- https://shepherd.caltech.edu/EDL/PublicResources/sdt/formats/nasa.html
%2.Understanding the NASA data of ideal gas thermodynamic properties in chemkin format- site link for pdf- https://jingweizhu.weebly.com/uploads/1/3/5/4/13548262/ideal_gas_thermodynamic_properties_in_chemkin_format.pdf
%3.Book to refer the chemkin plot data - https://www.osti.gov/servlets/purl/7073290
%4.Check thermodynamic values -http://combustion.berkeley.edu/gri-mech/data/thermo_table.html
%5.Basic of table in MATLAB-youtube video- https://www.youtube.com/watch?v=SbR5_i4UY0w
%6.Convert string to number youtube video -https://www.youtube.com/watch?v=DdOPybjKpkE
%7.MATLAB Video 4: Basic Strings, Concatenating Strings, and Char Function-youtube video- https://www.youtube.com/watch?v=NlUCU-0MXn4
%8.MATLAB/Otave for Beginners- Extracting Data From Tables, Matrices and Vectors -youtube video- https://www.youtube.com/watch?v=lh10T_uWIak
%9.Use of subplot command-youtube video- https://www.youtube.com/watch?v=BO5tqj_0bKQ
%10.To save multiple plot in folder by Moninka Shivhare -https://www.mathworks.com/matlabcentral/answers/403782-how-can-i-save-multiple-plots-in-a-specified-folder

%use of commands 
%1.Use of fprint f command - https://www.mathworks.com/help/matlab/ref/fprintf.html
%2.Use of split line command -https://www.mathworks.com/help/matlab/ref/splitlines.html
%3.Use of convert character to trings command -https://www.mathworks.com/help/matlab/ref/convertcharstostrings.html
%4.Use of switch case command -https://www.mathworks.com/help/matlab/ref/switch.html
%5.Use of extract Between command -https://www.mathworks.com/help/matlab/ref/extractbetween.html
%6.Use of table commands -https://www.mathworks.com/help/matlab/ref/table.html
%7.Use of concatenate array -https://www.mathworks.com/help/matlab/ref/double.cat.html
%8.Use of text to number command -https://www.mathworks.com/help/matlab/matlab_prog/converting-from-string-to-numeric.html
%9.USE OF ACCESS DATA IN TABLE -https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-table.html
%10.Use of cell to array(mat) command -https://www.mathworks.com/help/matlab/ref/cell2mat.html
%11.Use of switch case command -https://www.mathworks.com/help/matlab/ref/switch.html
%12.Determine array element not a number -https://www.mathworks.com/help/matlab/ref/isnan.html
%13.Determine array element a number -https://www.mathworks.com/help/matlab/ref/isnumeric.html
%14.Use of while loop -https://www.mathworks.com/help/matlab/ref/while.html

close all
clear all
clc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Reading data from given file
f1=fopen('THERMO.dat','r'); %this format defines file as f1 commanding to open file(' file name', with input mode of MATLAB System to read=r file)
%this command outputs the file f1 as a string data A using a array specifier 
% integer signed %d %i 
%floating point number %f %e %g 
%character conversion specifier %s %c
%here we will use %c character specifier which read any character,
%including white space and line change
global_character_line_A1=fscanf(f1,'%c');

%Now we will split the character array data with respect to its line and form individual CHARACTER CELL of data
individual_character_line_A2=splitlines(global_character_line_A1);
%We will convert the character value cells into string value cells
individual_string__line_A=convertCharsToStrings(individual_character_line_A2);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%GAS GENERAL CONFIGURATION DATA EXTRACTION
%%Here we will display the gas data and the minimum/median/maximum temperature so that the end user can select the gas
%for his calculation
%We will define a variable to select the first line from general string data
i1=linspace(6,214,53);

%here we will extrct the first line of each gas
gas_info_line_1=individual_string__line_A(i1(:,1:53));

%here we will extract the gas information string based on its position
gas=extractBetween(gas_info_line_1,1,8);
gas_identifier=extractBetween(gas_info_line_1,19,24);
atoms_number=extractBetween(gas_info_line_1,25,44);
Tmin=str2double(extractBetween(gas_info_line_1,45+4,45+10));
Tmax=str2double(extractBetween(gas_info_line_1,45+13,45+20));
Tmed=str2double(extractBetween(gas_info_line_1,45+23,45+30));

%%HIGH TEMPERATURE COEFFICIENT EXTRACTION
%We will define a variable to select the second and third line from general string data
i2=linspace(7,215,53);
i3=linspace(8,216,53);
%here we will extrct the second line of each gas
gas_info_line_2=individual_string__line_A(i2(:,1:53));
%here we will extrct the third line of each gas
gas_info_line_3=individual_string__line_A(i3(:,1:53));


%here we will extract the high temperature coefficients information from string based on position of E
line_2_positionE=cell2mat(strfind(gas_info_line_2,'E'));
line_3_positionE=cell2mat(strfind(gas_info_line_3,'E'));

%here we will extract the gas information string based on position of E and convert string into a number
a1=str2double(extractBetween(gas_info_line_2,1,line_2_positionE(:,1:1)+3));
a2=str2double(extractBetween(gas_info_line_2,line_2_positionE(:,1:1)+4,line_2_positionE(:,2:2)+3));
a3=str2double(extractBetween(gas_info_line_2,line_2_positionE(:,2:2)+4,line_2_positionE(:,3:3)+3));
a4=str2double(extractBetween(gas_info_line_2,line_2_positionE(:,3:3)+4,line_2_positionE(:,4:4)+3));
a5=str2double(extractBetween(gas_info_line_2,line_2_positionE(:,4:4)+4,line_2_positionE(:,5:5)+3));
a6=str2double(extractBetween(gas_info_line_3,1,line_3_positionE(:,1:1)+3));
a7=str2double(extractBetween(gas_info_line_3,line_3_positionE(:,1:1)+4,line_3_positionE(:,2:2)+3));


%%LOW TEMPERATURE COEFFICIENT EXTRACTION
%We will define a variable to select the fourth line from general string data
i4=linspace(9,217,53);
%here we will extrct the fourth line of each gas
gas_info_line_4=individual_string__line_A(i4(:,1:53));

%here we will extract the low temperature coefficients information from string based on position of E
line_4_positionE=cell2mat(strfind(gas_info_line_4,'E'));

%here we will extract the gas information string based on position of E and convert string into a number 
b1=str2double(extractBetween(gas_info_line_3,line_3_positionE(:,2:2)+4,line_3_positionE(:,3:3)+3));
b2=str2double(extractBetween(gas_info_line_3,line_3_positionE(:,3:3)+4,line_3_positionE(:,4:4)+3));
b3=str2double(extractBetween(gas_info_line_3,line_3_positionE(:,4:4)+4,line_3_positionE(:,5:5)+3));
b4=str2double(extractBetween(gas_info_line_4,1,line_4_positionE(:,1:1)+3));
b5=str2double(extractBetween(gas_info_line_4,line_4_positionE(:,1:1)+4,line_4_positionE(:,2:2)+3));
b6=str2double(extractBetween(gas_info_line_4,line_4_positionE(:,2:2)+4,line_4_positionE(:,3:3)+3));
b7=str2double(extractBetween(gas_info_line_4,line_4_positionE(:,3:3)+4,line_4_positionE(:,4:4)+3));


%%CONVERSION OF INDIVIDUAL EXTRACTED STRING INTO TABLE
%Here we will convert the string array into individual table
SrNo=linspace(1,53,53)';
SRNO=array2table(SrNo);
GAS=array2table(gas);
GAS_IDENTIFIER=array2table(gas_identifier);
ATOMS=array2table(atoms_number);
TMIN=array2table(Tmin);
TMED=array2table(Tmed);
TMAX=array2table(Tmax);
A1=array2table(a1);
A2=array2table(a2);
A3=array2table(a3);
A4=array2table(a4);
A5=array2table(a5);
A6=array2table(a6);
A7=array2table(a7);
B1=array2table(b1);
B2=array2table(b2);
B3=array2table(b3);
B4=array2table(b4);
B5=array2table(b5);
B6=array2table(b6);
B7=array2table(b7);

%%COMBINING THE TABLE
%we will use concatenation to combine the individual tables into one united table
disp('NASA THERMODYNAMIC GAS DATA SELECTION TABLE')
TABLE=cat(2,SRNO,GAS,GAS_IDENTIFIER,ATOMS,TMIN,TMED,TMAX,A1,A2,A3,A4,A5,A6,A7,B1,B2,B3,B4,B5,B6,B7)

Calculation=input('do yo want to calculate thermodynamic parameter? if yes enter 1 if No enter 0 =');

%We will use while loop to calculate the parameters by selecting the gases selected gases

while Calculation==1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%CODE TO SELECT AND EVALUATE THE PARAMETERS
%0. Enter the temperature of system
Tsystem=input('Enter the temperature of system between 300K to 5000 K in Kelvin scale=');
%1. Select the gas
Sr=input('select the gas and enter the sr no of gas given in 1st column of table=');


%Calculate the parameters
selected_gas=TABLE.gas(Sr:Sr);
disp('The termodynamic properties at selected system temperature Tsystem-Specific heat(J/mol-K), Specifc enthalpy(J/mol), Specific Entropy(J/mol-K) & Gibbs free energy(J/mol)')
[gas_specific_heat, gas_specific_enthalpy, gas_specific_entropy,  gas_specific_gibbs_free_energy]=w4_mb_function_parsing_nasa_data(TABLE,Tsystem,Sr)

%Calculate molecular mass
[molecular_mass]=w4_mb_function_parsing_nasa_data_molecular_mass(TABLE,Sr)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Here we will convert the calculated parameters into table so as to display as one
SRN=array2table(Sr);
T=array2table(Tsystem);
G=array2table(selected_gas);
CP=array2table(gas_specific_heat);
H=array2table(gas_specific_enthalpy);
S=array2table(gas_specific_entropy);
GFE=array2table(gas_specific_gibbs_free_energy);
M=array2table(molecular_mass);

GAS_PARAMETERS=cat(2,SRN,T,G,CP,H,S,GFE,M)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Evaluate polynomial data and plot specific heat, enthalpy, entropy with respect to temperature ranges
[T1, T2, gas_specific_heat_array1, gas_specific_heat_array2, gas_specific_enthalpy_array1, gas_specific_enthalpy_array2, gas_specific_entropy_array1, gas_specific_entropy_array2, gas_specific_gibbs_free_energy_array1, gas_specific_gibbs_free_energy_array2]=w4_mb_function_plot_parsing_nasa_data(TABLE,Sr);

f=figure(Sr);
subplot(2,2,1)
plot(T1,gas_specific_heat_array1,T2,gas_specific_heat_array2)
xlabel('Temperature (K)')
ylabel('Cp/R')
title(['Specific heat vs temperature ',num2str(selected_gas)])
subplot(2,2,2)
plot(T1,gas_specific_enthalpy_array1,T2,gas_specific_enthalpy_array2)
xlabel('Temperature (K)')
ylabel('H/(R*T)')
title(['Sp. Enthalpy vs temperature ',num2str(selected_gas)])
subplot(2,2,3)
plot(T1,gas_specific_entropy_array1,T2,gas_specific_entropy_array2)
xlabel('Temperature (K)')
ylabel('S/R')
title(['Sp. entropy vs temperature ',num2str(selected_gas)])
subplot(2,2,4)
plot(T1,gas_specific_gibbs_free_energy_array1,T2,gas_specific_gibbs_free_energy_array2)
xlabel('Temperature (K)')
ylabel('G/(R*T)')
title(['Gibbs energy vs temperature ',num2str(selected_gas)])

path='D:\CFD COURSE DATA\MATLAB\1.MATLAB CHALLENGE\w4_mb_challenge1\1.PLOTTING INDIVDUAL GAS DATA';
saveas(figure(Sr),fullfile(path,['Thermodynamic_Plot_Sr_' num2str(Sr) '.jpeg']));

%BREAKING OF While loop
Calculation=input('do yo want to continue the calculation of thermodynamic parameters? if yes enter 1 if No enter 0 =');
if Calculation==0
    disp('you have exited from the program')
    break
end
end
        

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [gas_specific_heat, gas_specific_enthalpy, gas_specific_entropy, gas_specific_gibbs_free_energy]=w4_mb_function_parsing_nasa_data(TABLE,Tsystem,Sr)
% we will extract the data from table to evaluate the parameters for selected gas
T=Tsystem;
Tmed_local=TABLE.Tmed(Sr:Sr);
%Specific gas constant in J/K.mol
R=8.31446;
if T>Tmed_local
    %we will extract the high temperature coefficient data from table
    a1=TABLE.a1(Sr:Sr);
    a2=TABLE.a2(Sr:Sr);
    a3=TABLE.a3(Sr:Sr);
    a4=TABLE.a4(Sr:Sr);
    a5=TABLE.a5(Sr:Sr);
    a6=TABLE.a6(Sr:Sr);
    a7=TABLE.a7(Sr:Sr);
    
    %evaluate the parameters of gas
    gas_specific_heat= (a1 + a2*T + a3*T^2 + a4*T^3 + a5*T^4)*R;
    gas_specific_enthalpy= (a1 + (a2*T)/2 + (a3*T^2)/3 + (a4*T^3)/4 + (a5*T^4)/5 + a6/T)*R*T;
    gas_specific_entropy= (a1*log(T) + a2*T + a3*T^2/2 + (a4*T^3)/3 + (a5*T^4)/5 + a7)*R;
    gas_specific_gibbs_free_energy=gas_specific_enthalpy-T*gas_specific_entropy;
else
    if T

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

1.2 OUTPUT

NASA THERMODYNAMIC GAS DATA SELECTION TABLE

TABLE =

53×21 table

SrNo gas gas_identifier atoms_number Tmin Tmed Tmax a1 a2 a3 a4 a5 a6 a7 b1 b2 b3 b4 b5 b6 b7
____ __________ ______________ ______________________ ____ ____ ____ ________ ___________ ___________ ___________ ___________ _______ ________ _______ ___________ ___________ ___________ ___________ _______ ________

1 "O " "L 1/90" "O 1 " 200 1000 3500 2.5694 -8.5974e-05 4.1948e-08 -1.0018e-11 1.2283e-15 29218 4.7843 3.1683 -0.0032793 6.6431e-06 -6.1281e-09 2.1127e-12 29122 2.0519
2 "O2 " "TPIS89" "O 2 " 200 1000 3500 3.2825 0.0014831 -7.5797e-07 2.0947e-10 -2.1672e-14 -1088.5 5.4532 3.7825 -0.0029967 9.8473e-06 -9.6813e-09 3.2437e-12 -1063.9 3.6577
3 "H " "L 7/88" "H 1 " 200 1000 3500 2.5 -2.3084e-11 1.6156e-14 -4.7352e-18 4.982e-22 25474 -0.44668 2.5 7.0533e-13 -1.9959e-15 2.3008e-18 -9.2773e-22 25474 -0.44668
4 "H2 " "TPIS78" "H 2 " 200 1000 3500 3.3373 -4.9402e-05 4.9946e-07 -1.7957e-10 2.0026e-14 -950.16 -3.205 2.3443 0.0079805 -1.9478e-05 2.0157e-08 -7.3761e-12 -917.94 0.68301
5 "OH " "RUS 78" "O 1H 1 " 200 1000 3500 3.0929 0.00054843 1.2651e-07 -8.7946e-11 1.1741e-14 3858.7 4.4767 3.992 -0.0024013 4.6179e-06 -3.8811e-09 1.3641e-12 3615.1 -0.10393
6 "H2O " "L 8/89" "H 2O 1 " 200 1000 3500 3.034 0.0021769 -1.6407e-07 -9.7042e-11 1.682e-14 -30004 4.9668 4.1986 -0.0020364 6.5204e-06 -5.488e-09 1.772e-12 -30294 -0.84903
7 "HO2 " "L 5/89" "H 1O 2 " 200 1000 3500 4.0172 0.0022398 -6.3366e-07 1.1425e-10 -1.0791e-14 111.86 3.7851 4.3018 -0.0047491 2.1158e-05 -2.4276e-08 9.2923e-12 294.81 3.7167
8 "H2O2 " "L 7/88" "H 2O 2 " 200 1000 3500 4.165 0.0049083 -1.9014e-06 3.7119e-10 -2.8791e-14 -17862 2.9162 4.2761 -0.00054282 1.6734e-05 -2.1577e-08 8.6245e-12 -17703 3.4351
9 "C " "L11/88" "C 1 " 200 1000 3500 2.4927 4.7989e-05 -7.2434e-08 3.7429e-11 -4.8728e-15 85451 4.8015 2.5542 -0.00032154 7.3379e-07 -7.3223e-10 2.6652e-13 85444 4.5313
10 "CH " "TPIS79" "C 1H 1 " 200 1000 3500 2.8785 0.00097091 1.4445e-07 -1.3069e-10 1.7608e-14 71012 5.485 3.4898 0.00032384 -1.689e-06 3.1622e-09 -1.4061e-12 70797 2.084
11 "CH2 " "L S/93" "C 1H 2 " 200 1000 3500 2.8741 0.0036564 -1.4089e-06 2.6018e-10 -1.8773e-14 46264 6.1712 3.7627 0.00096887 2.7949e-06 -3.8509e-09 1.6874e-12 46004 1.5625
12 "CH2(S) " "L S/93" "C 1H 2 " 200 1000 3500 2.292 0.0046559 -2.0119e-06 4.1791e-10 -3.3972e-14 50926 8.6265 4.1986 -0.0023666 8.233e-06 -6.6882e-09 1.9431e-12 50497 -0.76912
13 "CH3 " "L11/89" "C 1H 3 " 200 1000 3500 2.2857 0.0072399 -2.9871e-06 5.9568e-10 -4.6715e-14 16776 8.4801 3.6736 0.002011 5.7302e-06 -6.8712e-09 2.5439e-12 16445 1.6046
14 "CH4 " "L 8/88" "C 1H 4 " 200 1000 3500 0.074851 0.013391 -5.7329e-06 1.2229e-09 -1.0182e-13 -9468.3 18.437 5.1499 -0.013671 4.918e-05 -4.8474e-08 1.6669e-11 -10247 -4.6413
15 "CO " "TPIS79" "C 1O 1 " 200 1000 3500 2.7152 0.0020625 -9.9883e-07 2.3005e-10 -2.0365e-14 -14152 7.8187 3.5795 -0.00061035 1.0168e-06 9.0701e-10 -9.0442e-13 -14344 3.5084
16 "CO2 " "L 7/88" "C 1O 2 " 200 1000 3500 3.8575 0.0044144 -2.2148e-06 5.2349e-10 -4.7208e-14 -48759 2.2716 2.3568 0.0089846 -7.1236e-06 2.4592e-09 -1.437e-13 -48372 9.9011
17 "HCO " "L12/89" "H 1C 1O 1 " 200 1000 3500 2.7722 0.004957 -2.4845e-06 5.8916e-10 -5.3351e-14 4011.9 9.7983 4.2212 -0.0032439 1.378e-05 -1.3314e-08 4.3377e-12 3839.6 3.3944
18 "CH2O " "L 8/88" "H 2C 1O 1 " 200 1000 3500 1.7607 0.0092 -4.4226e-06 1.0064e-09 -8.8386e-14 -13996 13.656 4.7937 -0.0099083 3.7322e-05 -3.7929e-08 1.3177e-11 -14309 0.60281
19 "CH2OH " "GUNL93" "C 1H 3O 1 " 200 1000 3500 3.6927 0.0086458 -3.751e-06 7.8723e-10 -6.4855e-14 -3242.5 5.8104 3.8639 0.0055967 5.9327e-06 -1.0453e-08 4.3697e-12 -3193.9 5.473
20 "CH3O " "121686" "C 1H 3O 1 " 300 1000 3000 3.7708 0.0078715 -2.6564e-06 3.9444e-10 -2.1126e-14 127.83 2.9296 2.1062 0.0072166 5.3385e-06 -7.3776e-09 2.0756e-12 978.6 13.152
21 "CH3OH " "L 8/88" "C 1H 4O 1 " 200 1000 3500 1.7897 0.014094 -6.365e-06 1.3817e-09 -1.1706e-13 -25375 14.502 5.7154 -0.015231 6.5244e-05 -7.1081e-08 2.6135e-11 -25643 -1.5041
22 "C2H " "L 1/91" "C 2H 1 " 200 1000 3500 3.1678 0.0047522 -1.8379e-06 3.0419e-10 -1.7723e-14 67121 6.6359 2.8897 0.01341 -2.8477e-05 2.9479e-08 -1.0933e-11 66839 6.223
23 "C2H2 " "L 1/91" "C 2H 2 " 200 1000 3500 4.1476 0.0059617 -2.3729e-06 4.6741e-10 -3.6124e-14 25936 -1.2303 0.80868 0.023362 -3.5517e-05 2.8015e-08 -8.5007e-12 26429 13.94
24 "C2H3 " "L 2/92" "C 2H 3 " 200 1000 3500 3.0167 0.01033 -4.6808e-06 1.0176e-09 -8.6261e-14 34613 7.7873 3.2125 0.0015148 2.5921e-05 -3.5766e-08 1.4715e-11 34860 8.5105
25 "C2H4 " "L 1/91" "C 2H 4 " 200 1000 3500 2.0361 0.014645 -6.7108e-06 1.4722e-09 -1.2571e-13 4939.9 10.305 3.9592 -0.0075705 5.7099e-05 -6.9159e-08 2.6988e-11 5089.8 4.0973
26 "C2H5 " "L12/92" "C 2H 5 " 200 1000 3500 1.9547 0.017397 -7.9821e-06 1.7522e-09 -1.4964e-13 12858 13.462 4.3065 -0.0041866 4.9714e-05 -5.9913e-08 2.3051e-11 12842 4.7072
27 "C2H6 " "L 8/88" "C 2H 6 " 200 1000 3500 1.0719 0.021685 -1.0026e-05 2.2141e-09 -1.9e-13 -11426 15.116 4.2914 -0.0055015 5.9944e-05 -7.0847e-08 2.6869e-11 -11522 2.6668
28 "CH2CO " "L 5/90" "C 2H 2O 1 " 200 1000 3500 4.5113 0.0090036 -4.1694e-06 9.2335e-10 -7.9484e-14 -7551.1 0.63225 2.1358 0.018119 -1.7395e-05 9.344e-09 -2.0146e-12 -7042.9 12.216
29 "HCCO " "SRIC91" "H 1C 2O 1 " 300 1000 4000 5.6282 0.0040853 -1.5935e-06 2.8626e-10 -1.9408e-14 19327 -3.9303 2.2517 0.017655 -2.3729e-05 1.7276e-08 -5.0665e-12 20059 12.49
30 "HCCOH " " SRI91" "C 2O 1H 2 " 300 1000 5000 5.9238 0.0067924 -2.5659e-06 4.4988e-10 -2.994e-14 7264.6 -7.6018 1.2424 0.031072 -5.0867e-05 4.3137e-08 -1.4015e-11 8031.6 13.874
31 "H2CN " " 41687" "H 2C 1N 1 " 300 1000 4000 5.2097 0.0029693 -2.8556e-07 -1.6356e-10 3.0433e-14 27677 -4.4445 2.8517 0.0056952 1.0711e-06 -1.6226e-09 -2.3511e-13 28638 8.9928
32 "HCN " "GRI/98" "H 1C 1N 1 " 200 1000 6000 3.8022 0.0031464 -1.0632e-06 1.662e-10 -9.7998e-15 14407 1.5755 2.259 0.010051 -1.3352e-05 1.0092e-08 -3.0089e-12 14713 8.9164
33 "HNO " "And93 " "H 1N 1O 1 " 200 1000 6000 2.9793 0.0034944 -7.855e-07 5.748e-11 -1.9336e-16 11751 8.6064 4.5335 -0.0056696 1.8473e-05 -1.7137e-08 5.5455e-12 11548 1.7498
34 "N " "L 6/88" "N 1 " 200 1000 6000 2.4159 0.00017489 -1.1902e-07 3.0226e-11 -2.0361e-15 56134 4.6496 2.5 0 0 0 0 56105 4.1939
35 "NNH " "T07/93" "N 2H 1 " 200 1000 6000 3.7668 0.0028915 -1.0417e-06 1.6843e-10 -1.0092e-14 28651 4.4705 4.3447 -0.0048497 2.0059e-05 -2.1726e-08 7.947e-12 28792 2.9779
36 "N2O " "L 7/88" "N 2O 1 " 200 1000 6000 4.8231 0.002627 -9.5851e-07 1.6001e-10 -9.7752e-15 8073.4 -2.2017 2.2572 0.011305 -1.3671e-05 9.682e-09 -2.9307e-12 8741.8 10.758
37 "NH " "And94 " "N 1H 1 " 200 1000 6000 2.7837 0.0013298 -4.2478e-07 7.8349e-11 -5.5044e-15 42121 5.7408 3.4929 0.00031179 -1.489e-06 2.4816e-09 -1.0357e-12 41881 1.8483
38 "NH2 " "And89 " "N 1H 2 " 200 1000 6000 2.8347 0.0032073 -9.3391e-07 1.3703e-10 -7.9206e-15 22172 6.5204 4.204 -0.0021061 7.1068e-06 -5.6115e-09 1.6441e-12 21886 -0.14184
39 "NH3 " "J 6/77" "N 1H 3 " 200 1000 6000 2.6345 0.0056663 -1.7279e-06 2.3867e-10 -1.2579e-14 -6544.7 6.5663 4.286 -0.0046605 2.1719e-05 -2.2809e-08 8.2638e-12 -6741.7 -0.62537
40 "NO " "RUS 78" "N 1O 1 " 200 1000 6000 3.2606 0.0011911 -4.2917e-07 6.9458e-11 -4.0336e-15 9921 6.3693 4.2185 -0.004639 1.1041e-05 -9.3361e-09 2.8036e-12 9844.6 2.2808
41 "NO2 " "L 7/88" "N 1O 2 " 200 1000 6000 4.8848 0.0021724 -8.2807e-07 1.5748e-10 -1.0511e-14 2316.5 -0.11742 3.944 -0.0015854 1.6658e-05 -2.0475e-08 7.8351e-12 2896.6 6.312
42 "HCNO " "BDEA94" "H 1N 1C 1O 1" 300 1382 5000 6.5986 0.0030278 -1.077e-06 1.7167e-10 -1.0144e-14 17966 -10.331 2.6473 0.012751 -1.0479e-05 4.4143e-09 -7.5752e-13 19299 10.733
43 "HOCN " "BDEA94" "H 1N 1C 1O 1" 300 1368 5000 5.8978 0.0031679 -1.118e-06 1.7724e-10 -1.0434e-14 -3706.5 -6.1817 3.786 0.0068867 -3.2149e-06 5.172e-10 1.1936e-14 -2827 5.6329
44 "HNCO " "BDEA94" "H 1N 1C 1O 1" 300 1478 5000 6.224 0.0031786 -1.0938e-06 1.7074e-10 -9.9502e-15 -16660 -8.3822 3.631 0.0073028 -2.2805e-06 -6.6127e-10 3.6224e-13 -15587 6.1946
45 "NCO " "EA 93 " "N 1C 1O 1 " 200 1000 6000 5.1522 0.0023052 -8.8033e-07 1.4789e-10 -9.0978e-15 14004 -2.5443 2.8269 0.0088052 -8.3866e-06 4.8017e-09 -1.3314e-12 14682 9.5505
46 "CN " "HBH92 " "C 1N 1 " 200 1000 6000 3.746 4.3451e-05 2.9706e-07 -6.8652e-11 4.4134e-15 51536 2.7868 3.6129 -0.00095551 2.1443e-06 -3.1516e-10 -4.643e-13 51708 3.9805
47 "HCNN " "SRI/94" "C 1N 2H 1 " 300 1000 5000 5.8946 0.0039896 -1.5982e-06 2.9249e-10 -2.0095e-14 53453 -5.1031 2.5243 0.015961 -1.8816e-05 1.2126e-08 -3.2357e-12 54262 11.676
48 "N2 " "121286" "N 2 " 300 1000 5000 2.9266 0.001488 -5.6848e-07 1.0097e-10 -6.7534e-15 -922.8 5.9805 3.2987 0.0014082 -3.9632e-06 5.6415e-09 -2.4449e-12 -1020.9 3.9504
49 "AR " "120186" "AR 1 " 300 1000 5000 2.5 0 0 0 0 -745.38 4.366 2.5 0 0 0 0 -745.38 4.366
50 "C3H8 " "L 4/85" "C 3H 8 " 300 1000 5000 7.5341 0.018872 -6.2718e-06 9.1476e-10 -4.7838e-14 -16468 -17.892 0.93355 0.026425 6.106e-06 -2.1977e-08 9.5149e-12 -13959 19.202
51 "C3H7 " "L 9/84" "C 3H 7 " 300 1000 5000 7.7027 0.016044 -5.2833e-06 7.6299e-10 -3.9392e-14 8298.4 -15.48 1.0516 0.025992 2.3801e-06 -1.961e-08 9.3732e-12 10632 21.123
52 "CH3CHO " "L 8/88" "C 2H 4O 1 " 200 1000 6000 5.4041 0.011723 -4.2263e-06 6.8372e-10 -4.0985e-14 -22593 -3.4808 4.7295 -0.0031933 4.7535e-05 -5.7459e-08 2.1931e-11 -21573 4.103
53 "CH2CHO " "SAND86" "O 1H 3C 2 " 300 1000 5000 5.9757 0.0081306 -2.7436e-06 4.0703e-10 -2.176e-14 490.32 -5.0453 3.4091 0.010739 1.8915e-06 -7.1586e-09 2.8674e-12 1521.5 9.5583

do yo want to calculate thermodynamic parameter? if yes enter 1 if No enter 0 =1
Enter the temperature of system between 300K to 5000 K in Kelvin scale=500
select the gas and enter the sr no of gas given in 1st column of table=2
The termodynamic properties at selected system temperature Tsystem-Specific heat(J/mol-K), Specifc enthalpy(J/mol), Specific Entropy(J/mol-K) & Gibbs free energy(J/mol)

gas_specific_heat =

31.0835


gas_specific_enthalpy =

6.0862e+03


gas_specific_entropy =

220.6148


gas_specific_gibbs_free_energy =

-1.0422e+05


molecular_mass =

31.9988


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

2 500 "O2 " 31.083 6086.2 220.61 -1.0422e+05 31.999

do yo want to continue the calculation of thermodynamic parameters? if yes enter 1 if No enter 0 =1
Enter the temperature of system between 300K to 5000 K in Kelvin scale=500
select the gas and enter the sr no of gas given in 1st column of table=16
The termodynamic properties at selected system temperature Tsystem-Specific heat(J/mol-K), Specifc enthalpy(J/mol), Specific Entropy(J/mol-K) & Gibbs free energy(J/mol)

gas_specific_heat =

44.6204


gas_specific_enthalpy =

-3.8521e+05


gas_specific_entropy =

234.8835


gas_specific_gibbs_free_energy =

-5.0265e+05


molecular_mass =

44.0098


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

16 500 "CO2 " 44.62 -3.8521e+05 234.88 -5.0265e+05 44.01

do yo want to continue the calculation of thermodynamic parameters? if yes enter 1 if No enter 0 =1
Enter the temperature of system between 300K to 5000 K in Kelvin scale=500
select the gas and enter the sr no of gas given in 1st column of table=48
The termodynamic properties at selected system temperature Tsystem-Specific heat(J/mol-K), Specifc enthalpy(J/mol), Specific Entropy(J/mol-K) & Gibbs free energy(J/mol)

gas_specific_heat =

29.6359


gas_specific_enthalpy =

5.9216e+03


gas_specific_entropy =

206.7272


gas_specific_gibbs_free_energy =

-9.7442e+04


molecular_mass =

28.0200


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

48 500 "N2 " 29.636 5921.6 206.73 -97442 28.02

do yo want to continue the calculation of thermodynamic parameters? if yes enter 1 if No enter 0 =0
you have exited from the program
>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

1.3 SCREENSHOTS

TABLE

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

1. O2 GAS OUTPUT WITH TABLE

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2. CO2 GAS OUTPUT WITH TABLE

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

3. N2 GAS OUTPUT WITH TABLE

ALL

4. FOLDER SCREENSHOT SAVING PLOT AUTOMATICALLY

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2. PARSE ALL DATA

2.1 CODE

%OBJECTIVE 2 PARSING ALL DATA
%W4 MATLAB BASIC-PARSING NASA THERMODYNAMIC DATA
%SKILL-LYNC-Bhavin Chaudhary-7 April 2022 to 14 April 2022


%OBJECTIVE
%To parse or read the NASA Thermodynamic data into simplified and easy to interprete data format. 

%METHODOLOGY
%1. Generate string from file (read the data)
%2. Filter or extract the individual gas data 
%3. Convert the data into table(easy to read)
%4. extract the elements and calculate the specific heat, enthalpy and entropy
%5. calculate the molecular mass of gas
%6. plot the specific heat, enthalpy,and entropy w.r.t temperature 


%CITATION
%Understanding the data structure
%1.Understanding the NASA Thermodynamic data formatting method- pdf link- https://shepherd.caltech.edu/EDL/PublicResources/sdt/formats/nasa.html
%2.Understanding the NASA data of ideal gas thermodynamic properties in chemkin format- site link for pdf- https://jingweizhu.weebly.com/uploads/1/3/5/4/13548262/ideal_gas_thermodynamic_properties_in_chemkin_format.pdf
%3.Book to refer the chemkin plot data - https://www.osti.gov/servlets/purl/7073290
%4.Check thermodynamic values -http://combustion.berkeley.edu/gri-mech/data/thermo_table.html
%5.Basic of table in MATLAB-youtube video- https://www.youtube.com/watch?v=SbR5_i4UY0w
%6.Convert string to number youtube video -https://www.youtube.com/watch?v=DdOPybjKpkE
%7.MATLAB Video 4: Basic Strings, Concatenating Strings, and Char Function-youtube video- https://www.youtube.com/watch?v=NlUCU-0MXn4
%8.MATLAB/Otave for Beginners- Extracting Data From Tables, Matrices and Vectors -youtube video- https://www.youtube.com/watch?v=lh10T_uWIak
%9.Use of subplot command-youtube video- https://www.youtube.com/watch?v=BO5tqj_0bKQ
%10.To save multiple plot in folder by Moninka Shivhare -https://www.mathworks.com/matlabcentral/answers/403782-how-can-i-save-multiple-plots-in-a-specified-folder

%use of commands 
%1.Use of fprint f command - https://www.mathworks.com/help/matlab/ref/fprintf.html
%2.Use of split line command -https://www.mathworks.com/help/matlab/ref/splitlines.html
%3.Use of convert character to trings command -https://www.mathworks.com/help/matlab/ref/convertcharstostrings.html
%4.Use of switch case command -https://www.mathworks.com/help/matlab/ref/switch.html
%5.Use of extract Between command -https://www.mathworks.com/help/matlab/ref/extractbetween.html
%6.Use of table commands -https://www.mathworks.com/help/matlab/ref/table.html
%7.Use of concatenate array -https://www.mathworks.com/help/matlab/ref/double.cat.html
%8.Use of text to number command -https://www.mathworks.com/help/matlab/matlab_prog/converting-from-string-to-numeric.html
%9.USE OF ACCESS DATA IN TABLE -https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-table.html
%10.Use of cell to array(mat) command -https://www.mathworks.com/help/matlab/ref/cell2mat.html
%11.Determine array element not a number -https://www.mathworks.com/help/matlab/ref/isnan.html
%12.Determine array element a number -https://www.mathworks.com/help/matlab/ref/isnumeric.html


close all
clear all
clc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Reading data from given file
f1=fopen('THERMO.dat','r'); %this format defines file as f1 commanding to open file(' file name', with input mode of MATLAB System to read=r file)
%this command outputs the file f1 as a string data A using a array specifier 
% integer signed %d %i 
%floating point number %f %e %g 
%character conversion specifier %s %c
%here we will use %c character specifier which read any character,
%including white space and line change
global_character_line_A1=fscanf(f1,'%c');

%Now we will split the character array data with respect to its line and form individual CHARACTER CELL of data
individual_character_line_A2=splitlines(global_character_line_A1);
%We will convert the character value cells into string value cells
individual_string__line_A=convertCharsToStrings(individual_character_line_A2);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%GAS GENERAL CONFIGURATION DATA EXTRACTION
%%Here we will display the gas data and the minimum/median/maximum temperature so that the end user can select the gas
%for his calculation
%We will define a variable to select the first line from general string data
i1=linspace(6,214,53);

%here we will extrct the first line of each gas
gas_info_line_1=individual_string__line_A(i1(:,1:53));

%here we will extract the gas information string based on its position
gas=extractBetween(gas_info_line_1,1,8);
gas_identifier=extractBetween(gas_info_line_1,19,24);
atoms_number=extractBetween(gas_info_line_1,25,44);
Tmin=str2double(extractBetween(gas_info_line_1,45+4,45+10));
Tmax=str2double(extractBetween(gas_info_line_1,45+13,45+20));
Tmed=str2double(extractBetween(gas_info_line_1,45+23,45+30));

%%HIGH TEMPERATURE COEFFICIENT EXTRACTION
%We will define a variable to select the second and third line from general string data
i2=linspace(7,215,53);
i3=linspace(8,216,53);
%here we will extrct the second line of each gas
gas_info_line_2=individual_string__line_A(i2(:,1:53));
%here we will extrct the third line of each gas
gas_info_line_3=individual_string__line_A(i3(:,1:53));


%here we will extract the high temperature coefficients information from string based on position of E
line_2_positionE=cell2mat(strfind(gas_info_line_2,'E'));
line_3_positionE=cell2mat(strfind(gas_info_line_3,'E'));

%here we will extract the gas information string based on position of E and convert string into a number
a1=str2double(extractBetween(gas_info_line_2,1,line_2_positionE(:,1:1)+3));
a2=str2double(extractBetween(gas_info_line_2,line_2_positionE(:,1:1)+4,line_2_positionE(:,2:2)+3));
a3=str2double(extractBetween(gas_info_line_2,line_2_positionE(:,2:2)+4,line_2_positionE(:,3:3)+3));
a4=str2double(extractBetween(gas_info_line_2,line_2_positionE(:,3:3)+4,line_2_positionE(:,4:4)+3));
a5=str2double(extractBetween(gas_info_line_2,line_2_positionE(:,4:4)+4,line_2_positionE(:,5:5)+3));
a6=str2double(extractBetween(gas_info_line_3,1,line_3_positionE(:,1:1)+3));
a7=str2double(extractBetween(gas_info_line_3,line_3_positionE(:,1:1)+4,line_3_positionE(:,2:2)+3));


%%LOW TEMPERATURE COEFFICIENT EXTRACTION
%We will define a variable to select the fourth line from general string data
i4=linspace(9,217,53);
%here we will extrct the fourth line of each gas
gas_info_line_4=individual_string__line_A(i4(:,1:53));

%here we will extract the low temperature coefficients information from string based on position of E
line_4_positionE=cell2mat(strfind(gas_info_line_4,'E'));

%here we will extract the gas information string based on position of E and convert string into a number 
b1=str2double(extractBetween(gas_info_line_3,line_3_positionE(:,2:2)+4,line_3_positionE(:,3:3)+3));
b2=str2double(extractBetween(gas_info_line_3,line_3_positionE(:,3:3)+4,line_3_positionE(:,4:4)+3));
b3=str2double(extractBetween(gas_info_line_3,line_3_positionE(:,4:4)+4,line_3_positionE(:,5:5)+3));
b4=str2double(extractBetween(gas_info_line_4,1,line_4_positionE(:,1:1)+3));
b5=str2double(extractBetween(gas_info_line_4,line_4_positionE(:,1:1)+4,line_4_positionE(:,2:2)+3));
b6=str2double(extractBetween(gas_info_line_4,line_4_positionE(:,2:2)+4,line_4_positionE(:,3:3)+3));
b7=str2double(extractBetween(gas_info_line_4,line_4_positionE(:,3:3)+4,line_4_positionE(:,4:4)+3));


%%CONVERSION OF INDIVIDUAL EXTRACTED STRING INTO TABLE
%Here we will convert the string array into individual table
SrNo=linspace(1,53,53)';
SRNO=array2table(SrNo);
GAS=array2table(gas);
GAS_IDENTIFIER=array2table(gas_identifier);
ATOMS=array2table(atoms_number);
TMIN=array2table(Tmin);
TMED=array2table(Tmed);
TMAX=array2table(Tmax);
A1=array2table(a1);
A2=array2table(a2);
A3=array2table(a3);
A4=array2table(a4);
A5=array2table(a5);
A6=array2table(a6);
A7=array2table(a7);
B1=array2table(b1);
B2=array2table(b2);
B3=array2table(b3);
B4=array2table(b4);
B5=array2table(b5);
B6=array2table(b6);
B7=array2table(b7);

%%COMBINING THE TABLE
%we will use concatenation to combine the individual tables into one united table
disp('NASA THERMODYNAMIC GAS DATA SELECTION TABLE')
TABLE=cat(2,SRNO,GAS,GAS_IDENTIFIER,ATOMS,TMIN,TMED,TMAX,A1,A2,A3,A4,A5,A6,A7,B1,B2,B3,B4,B5,B6,B7)

Calculation=input('do yo want to calculate thermodynamic parameter? if yes enter 1 if No enter 0 =');

%We will use while loop to calculate the parameters by selecting the gases selected gases

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%CODE TO SELECT AND EVALUATE THE PARAMETERS
%0. Enter the temperature of system
Tsystem=input('Enter the temperature of system between 300K to 5000 K in Kelvin scale=');
Serial=1:1:53;

disp('The termodynamic properties at selected system temperature Tsystem-Specific heat(J/mol-K), Specifc enthalpy(J/mol) & Specific Entropy(J/mol-K)')
for i=1:length(Serial)
    Sr=Serial(i);
%Calculate the parameters
selected_gas=TABLE.gas(Sr:Sr);
[gas_specific_heat, gas_specific_enthalpy, gas_specific_entropy,  gas_specific_gibbs_free_energy]=w4_mb_function_parsing_nasa_data(TABLE,Tsystem,Sr);

%Calculate molecular mass
[molecular_mass]=w4_mb_function_parsing_nasa_data_molecular_mass(TABLE,Sr);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Here we will convert the calculated parameters into table so as to display as one
SRN=array2table(Sr);
T=array2table(Tsystem);
G=array2table(selected_gas);
CP=array2table(gas_specific_heat);
H=array2table(gas_specific_enthalpy);
S=array2table(gas_specific_entropy);
GFE=array2table(gas_specific_gibbs_free_energy);
M=array2table(molecular_mass);


GAS_PARAMETERS=cat(2,SRN,T,G,CP,H,S,GFE,M)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Evaluate polynomial data and plot specific heat, enthalpy, entropy with respect to temperature ranges
[T1, T2, gas_specific_heat_array1, gas_specific_heat_array2, gas_specific_enthalpy_array1, gas_specific_enthalpy_array2, gas_specific_entropy_array1, gas_specific_entropy_array2, gas_specific_gibbs_free_energy_array1, gas_specific_gibbs_free_energy_array2]=w4_mb_function_plot_parsing_nasa_data(TABLE,Sr);

f=figure(Sr);
subplot(2,2,1)
plot(T1,gas_specific_heat_array1,T2,gas_specific_heat_array2)
xlabel('Temperature (K)')
ylabel('Cp/R')
title(['Specific heat vs temperature ',num2str(selected_gas)])
subplot(2,2,2)
plot(T1,gas_specific_enthalpy_array1,T2,gas_specific_enthalpy_array2)
xlabel('Temperature (K)')
ylabel('H/(R*T)')
title(['Sp. Enthalpy vs temperature ',num2str(selected_gas)])
subplot(2,2,3)
plot(T1,gas_specific_entropy_array1,T2,gas_specific_entropy_array2)
xlabel('Temperature (K)')
ylabel('S/R')
title(['Sp. entropy vs temperature ',num2str(selected_gas)])
subplot(2,2,4)
plot(T1,gas_specific_gibbs_free_energy_array1,T2,gas_specific_gibbs_free_energy_array2)
xlabel('Temperature (K)')
ylabel('G/(R*T)')
title(['Gibbs energy vs temperature ',num2str(selected_gas)])

path='D:\CFD COURSE DATA\MATLAB\1.MATLAB CHALLENGE\w4_mb_challenge1\2.PLOTTING ALL GAS DATA';
saveas(figure(Sr),fullfile(path,['Gas_Thermodynamic_data_Plot_Sr_' num2str(Sr) '.jpeg']));

end
        
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [gas_specific_heat, gas_specific_enthalpy, gas_specific_entropy, gas_specific_gibbs_free_energy]=w4_mb_function_parsing_nasa_data(TABLE,Tsystem,Sr)
% we will extract the data from table to evaluate the parameters for selected gas
T=Tsystem;
Tmed_local=TABLE.Tmed(Sr:Sr);
%Specific gas constant in J/K.mol
R=8.31446;
if T>Tmed_local
    %we will extract the high temperature coefficient data from table
    a1=TABLE.a1(Sr:Sr);
    a2=TABLE.a2(Sr:Sr);
    a3=TABLE.a3(Sr:Sr);
    a4=TABLE.a4(Sr:Sr);
    a5=TABLE.a5(Sr:Sr);
    a6=TABLE.a6(Sr:Sr);
    a7=TABLE.a7(Sr:Sr);
    
    %evaluate the parameters of gas
    gas_specific_heat= (a1 + a2*T + a3*T^2 + a4*T^3 + a5*T^4)*R;
    gas_specific_enthalpy= (a1 + (a2*T)/2 + (a3*T^2)/3 + (a4*T^3)/4 + (a5*T^4)/5 + a6/T)*R*T;
    gas_specific_entropy= (a1*log(T) + a2*T + a3*T^2/2 + (a4*T^3)/3 + (a5*T^4)/5 + a7)*R;
    gas_specific_gibbs_free_energy=gas_specific_enthalpy-T*gas_specific_entropy;
else
    if T

2.2 OUTPUT

NASA THERMODYNAMIC GAS DATA SELECTION TABLE

TABLE =

53×21 table

SrNo gas gas_identifier atoms_number Tmin Tmed Tmax a1 a2 a3 a4 a5 a6 a7 b1 b2 b3 b4 b5 b6 b7
____ __________ ______________ ______________________ ____ ____ ____ ________ ___________ ___________ ___________ ___________ _______ ________ _______ ___________ ___________ ___________ ___________ _______ ________

1 "O " "L 1/90" "O 1 " 200 1000 3500 2.5694 -8.5974e-05 4.1948e-08 -1.0018e-11 1.2283e-15 29218 4.7843 3.1683 -0.0032793 6.6431e-06 -6.1281e-09 2.1127e-12 29122 2.0519
2 "O2 " "TPIS89" "O 2 " 200 1000 3500 3.2825 0.0014831 -7.5797e-07 2.0947e-10 -2.1672e-14 -1088.5 5.4532 3.7825 -0.0029967 9.8473e-06 -9.6813e-09 3.2437e-12 -1063.9 3.6577
3 "H " "L 7/88" "H 1 " 200 1000 3500 2.5 -2.3084e-11 1.6156e-14 -4.7352e-18 4.982e-22 25474 -0.44668 2.5 7.0533e-13 -1.9959e-15 2.3008e-18 -9.2773e-22 25474 -0.44668
4 "H2 " "TPIS78" "H 2 " 200 1000 3500 3.3373 -4.9402e-05 4.9946e-07 -1.7957e-10 2.0026e-14 -950.16 -3.205 2.3443 0.0079805 -1.9478e-05 2.0157e-08 -7.3761e-12 -917.94 0.68301
5 "OH " "RUS 78" "O 1H 1 " 200 1000 3500 3.0929 0.00054843 1.2651e-07 -8.7946e-11 1.1741e-14 3858.7 4.4767 3.992 -0.0024013 4.6179e-06 -3.8811e-09 1.3641e-12 3615.1 -0.10393
6 "H2O " "L 8/89" "H 2O 1 " 200 1000 3500 3.034 0.0021769 -1.6407e-07 -9.7042e-11 1.682e-14 -30004 4.9668 4.1986 -0.0020364 6.5204e-06 -5.488e-09 1.772e-12 -30294 -0.84903
7 "HO2 " "L 5/89" "H 1O 2 " 200 1000 3500 4.0172 0.0022398 -6.3366e-07 1.1425e-10 -1.0791e-14 111.86 3.7851 4.3018 -0.0047491 2.1158e-05 -2.4276e-08 9.2923e-12 294.81 3.7167
8 "H2O2 " "L 7/88" "H 2O 2 " 200 1000 3500 4.165 0.0049083 -1.9014e-06 3.7119e-10 -2.8791e-14 -17862 2.9162 4.2761 -0.00054282 1.6734e-05 -2.1577e-08 8.6245e-12 -17703 3.4351
9 "C " "L11/88" "C 1 " 200 1000 3500 2.4927 4.7989e-05 -7.2434e-08 3.7429e-11 -4.8728e-15 85451 4.8015 2.5542 -0.00032154 7.3379e-07 -7.3223e-10 2.6652e-13 85444 4.5313
10 "CH " "TPIS79" "C 1H 1 " 200 1000 3500 2.8785 0.00097091 1.4445e-07 -1.3069e-10 1.7608e-14 71012 5.485 3.4898 0.00032384 -1.689e-06 3.1622e-09 -1.4061e-12 70797 2.084
11 "CH2 " "L S/93" "C 1H 2 " 200 1000 3500 2.8741 0.0036564 -1.4089e-06 2.6018e-10 -1.8773e-14 46264 6.1712 3.7627 0.00096887 2.7949e-06 -3.8509e-09 1.6874e-12 46004 1.5625
12 "CH2(S) " "L S/93" "C 1H 2 " 200 1000 3500 2.292 0.0046559 -2.0119e-06 4.1791e-10 -3.3972e-14 50926 8.6265 4.1986 -0.0023666 8.233e-06 -6.6882e-09 1.9431e-12 50497 -0.76912
13 "CH3 " "L11/89" "C 1H 3 " 200 1000 3500 2.2857 0.0072399 -2.9871e-06 5.9568e-10 -4.6715e-14 16776 8.4801 3.6736 0.002011 5.7302e-06 -6.8712e-09 2.5439e-12 16445 1.6046
14 "CH4 " "L 8/88" "C 1H 4 " 200 1000 3500 0.074851 0.013391 -5.7329e-06 1.2229e-09 -1.0182e-13 -9468.3 18.437 5.1499 -0.013671 4.918e-05 -4.8474e-08 1.6669e-11 -10247 -4.6413
15 "CO " "TPIS79" "C 1O 1 " 200 1000 3500 2.7152 0.0020625 -9.9883e-07 2.3005e-10 -2.0365e-14 -14152 7.8187 3.5795 -0.00061035 1.0168e-06 9.0701e-10 -9.0442e-13 -14344 3.5084
16 "CO2 " "L 7/88" "C 1O 2 " 200 1000 3500 3.8575 0.0044144 -2.2148e-06 5.2349e-10 -4.7208e-14 -48759 2.2716 2.3568 0.0089846 -7.1236e-06 2.4592e-09 -1.437e-13 -48372 9.9011
17 "HCO " "L12/89" "H 1C 1O 1 " 200 1000 3500 2.7722 0.004957 -2.4845e-06 5.8916e-10 -5.3351e-14 4011.9 9.7983 4.2212 -0.0032439 1.378e-05 -1.3314e-08 4.3377e-12 3839.6 3.3944
18 "CH2O " "L 8/88" "H 2C 1O 1 " 200 1000 3500 1.7607 0.0092 -4.4226e-06 1.0064e-09 -8.8386e-14 -13996 13.656 4.7937 -0.0099083 3.7322e-05 -3.7929e-08 1.3177e-11 -14309 0.60281
19 "CH2OH " "GUNL93" "C 1H 3O 1 " 200 1000 3500 3.6927 0.0086458 -3.751e-06 7.8723e-10 -6.4855e-14 -3242.5 5.8104 3.8639 0.0055967 5.9327e-06 -1.0453e-08 4.3697e-12 -3193.9 5.473
20 "CH3O " "121686" "C 1H 3O 1 " 300 1000 3000 3.7708 0.0078715 -2.6564e-06 3.9444e-10 -2.1126e-14 127.83 2.9296 2.1062 0.0072166 5.3385e-06 -7.3776e-09 2.0756e-12 978.6 13.152
21 "CH3OH " "L 8/88" "C 1H 4O 1 " 200 1000 3500 1.7897 0.014094 -6.365e-06 1.3817e-09 -1.1706e-13 -25375 14.502 5.7154 -0.015231 6.5244e-05 -7.1081e-08 2.6135e-11 -25643 -1.5041
22 "C2H " "L 1/91" "C 2H 1 " 200 1000 3500 3.1678 0.0047522 -1.8379e-06 3.0419e-10 -1.7723e-14 67121 6.6359 2.8897 0.01341 -2.8477e-05 2.9479e-08 -1.0933e-11 66839 6.223
23 "C2H2 " "L 1/91" "C 2H 2 " 200 1000 3500 4.1476 0.0059617 -2.3729e-06 4.6741e-10 -3.6124e-14 25936 -1.2303 0.80868 0.023362 -3.5517e-05 2.8015e-08 -8.5007e-12 26429 13.94
24 "C2H3 " "L 2/92" "C 2H 3 " 200 1000 3500 3.0167 0.01033 -4.6808e-06 1.0176e-09 -8.6261e-14 34613 7.7873 3.2125 0.0015148 2.5921e-05 -3.5766e-08 1.4715e-11 34860 8.5105
25 "C2H4 " "L 1/91" "C 2H 4 " 200 1000 3500 2.0361 0.014645 -6.7108e-06 1.4722e-09 -1.2571e-13 4939.9 10.305 3.9592 -0.0075705 5.7099e-05 -6.9159e-08 2.6988e-11 5089.8 4.0973
26 "C2H5 " "L12/92" "C 2H 5 " 200 1000 3500 1.9547 0.017397 -7.9821e-06 1.7522e-09 -1.4964e-13 12858 13.462 4.3065 -0.0041866 4.9714e-05 -5.9913e-08 2.3051e-11 12842 4.7072
27 "C2H6 " "L 8/88" "C 2H 6 " 200 1000 3500 1.0719 0.021685 -1.0026e-05 2.2141e-09 -1.9e-13 -11426 15.116 4.2914 -0.0055015 5.9944e-05 -7.0847e-08 2.6869e-11 -11522 2.6668
28 "CH2CO " "L 5/90" "C 2H 2O 1 " 200 1000 3500 4.5113 0.0090036 -4.1694e-06 9.2335e-10 -7.9484e-14 -7551.1 0.63225 2.1358 0.018119 -1.7395e-05 9.344e-09 -2.0146e-12 -7042.9 12.216
29 "HCCO " "SRIC91" "H 1C 2O 1 " 300 1000 4000 5.6282 0.0040853 -1.5935e-06 2.8626e-10 -1.9408e-14 19327 -3.9303 2.2517 0.017655 -2.3729e-05 1.7276e-08 -5.0665e-12 20059 12.49
30 "HCCOH " " SRI91" "C 2O 1H 2 " 300 1000 5000 5.9238 0.0067924 -2.5659e-06 4.4988e-10 -2.994e-14 7264.6 -7.6018 1.2424 0.031072 -5.0867e-05 4.3137e-08 -1.4015e-11 8031.6 13.874
31 "H2CN " " 41687" "H 2C 1N 1 " 300 1000 4000 5.2097 0.0029693 -2.8556e-07 -1.6356e-10 3.0433e-14 27677 -4.4445 2.8517 0.0056952 1.0711e-06 -1.6226e-09 -2.3511e-13 28638 8.9928
32 "HCN " "GRI/98" "H 1C 1N 1 " 200 1000 6000 3.8022 0.0031464 -1.0632e-06 1.662e-10 -9.7998e-15 14407 1.5755 2.259 0.010051 -1.3352e-05 1.0092e-08 -3.0089e-12 14713 8.9164
33 "HNO " "And93 " "H 1N 1O 1 " 200 1000 6000 2.9793 0.0034944 -7.855e-07 5.748e-11 -1.9336e-16 11751 8.6064 4.5335 -0.0056696 1.8473e-05 -1.7137e-08 5.5455e-12 11548 1.7498
34 "N " "L 6/88" "N 1 " 200 1000 6000 2.4159 0.00017489 -1.1902e-07 3.0226e-11 -2.0361e-15 56134 4.6496 2.5 0 0 0 0 56105 4.1939
35 "NNH " "T07/93" "N 2H 1 " 200 1000 6000 3.7668 0.0028915 -1.0417e-06 1.6843e-10 -1.0092e-14 28651 4.4705 4.3447 -0.0048497 2.0059e-05 -2.1726e-08 7.947e-12 28792 2.9779
36 "N2O " "L 7/88" "N 2O 1 " 200 1000 6000 4.8231 0.002627 -9.5851e-07 1.6001e-10 -9.7752e-15 8073.4 -2.2017 2.2572 0.011305 -1.3671e-05 9.682e-09 -2.9307e-12 8741.8 10.758
37 "NH " "And94 " "N 1H 1 " 200 1000 6000 2.7837 0.0013298 -4.2478e-07 7.8349e-11 -5.5044e-15 42121 5.7408 3.4929 0.00031179 -1.489e-06 2.4816e-09 -1.0357e-12 41881 1.8483
38 "NH2 " "And89 " "N 1H 2 " 200 1000 6000 2.8347 0.0032073 -9.3391e-07 1.3703e-10 -7.9206e-15 22172 6.5204 4.204 -0.0021061 7.1068e-06 -5.6115e-09 1.6441e-12 21886 -0.14184
39 "NH3 " "J 6/77" "N 1H 3 " 200 1000 6000 2.6345 0.0056663 -1.7279e-06 2.3867e-10 -1.2579e-14 -6544.7 6.5663 4.286 -0.0046605 2.1719e-05 -2.2809e-08 8.2638e-12 -6741.7 -0.62537
40 "NO " "RUS 78" "N 1O 1 " 200 1000 6000 3.2606 0.0011911 -4.2917e-07 6.9458e-11 -4.0336e-15 9921 6.3693 4.2185 -0.004639 1.1041e-05 -9.3361e-09 2.8036e-12 9844.6 2.2808
41 "NO2 " "L 7/88" "N 1O 2 " 200 1000 6000 4.8848 0.0021724 -8.2807e-07 1.5748e-10 -1.0511e-14 2316.5 -0.11742 3.944 -0.0015854 1.6658e-05 -2.0475e-08 7.8351e-12 2896.6 6.312
42 "HCNO " "BDEA94" "H 1N 1C 1O 1" 300 1382 5000 6.5986 0.0030278 -1.077e-06 1.7167e-10 -1.0144e-14 17966 -10.331 2.6473 0.012751 -1.0479e-05 4.4143e-09 -7.5752e-13 19299 10.733
43 "HOCN " "BDEA94" "H 1N 1C 1O 1" 300 1368 5000 5.8978 0.0031679 -1.118e-06 1.7724e-10 -1.0434e-14 -3706.5 -6.1817 3.786 0.0068867 -3.2149e-06 5.172e-10 1.1936e-14 -2827 5.6329
44 "HNCO " "BDEA94" "H 1N 1C 1O 1" 300 1478 5000 6.224 0.0031786 -1.0938e-06 1.7074e-10 -9.9502e-15 -16660 -8.3822 3.631 0.0073028 -2.2805e-06 -6.6127e-10 3.6224e-13 -15587 6.1946
45 "NCO " "EA 93 " "N 1C 1O 1 " 200 1000 6000 5.1522 0.0023052 -8.8033e-07 1.4789e-10 -9.0978e-15 14004 -2.5443 2.8269 0.0088052 -8.3866e-06 4.8017e-09 -1.3314e-12 14682 9.5505
46 "CN " "HBH92 " "C 1N 1 " 200 1000 6000 3.746 4.3451e-05 2.9706e-07 -6.8652e-11 4.4134e-15 51536 2.7868 3.6129 -0.00095551 2.1443e-06 -3.1516e-10 -4.643e-13 51708 3.9805
47 "HCNN " "SRI/94" "C 1N 2H 1 " 300 1000 5000 5.8946 0.0039896 -1.5982e-06 2.9249e-10 -2.0095e-14 53453 -5.1031 2.5243 0.015961 -1.8816e-05 1.2126e-08 -3.2357e-12 54262 11.676
48 "N2 " "121286" "N 2 " 300 1000 5000 2.9266 0.001488 -5.6848e-07 1.0097e-10 -6.7534e-15 -922.8 5.9805 3.2987 0.0014082 -3.9632e-06 5.6415e-09 -2.4449e-12 -1020.9 3.9504
49 "AR " "120186" "AR 1 " 300 1000 5000 2.5 0 0 0 0 -745.38 4.366 2.5 0 0 0 0 -745.38 4.366
50 "C3H8 " "L 4/85" "C 3H 8 " 300 1000 5000 7.5341 0.018872 -6.2718e-06 9.1476e-10 -4.7838e-14 -16468 -17.892 0.93355 0.026425 6.106e-06 -2.1977e-08 9.5149e-12 -13959 19.202
51 "C3H7 " "L 9/84" "C 3H 7 " 300 1000 5000 7.7027 0.016044 -5.2833e-06 7.6299e-10 -3.9392e-14 8298.4 -15.48 1.0516 0.025992 2.3801e-06 -1.961e-08 9.3732e-12 10632 21.123
52 "CH3CHO " "L 8/88" "C 2H 4O 1 " 200 1000 6000 5.4041 0.011723 -4.2263e-06 6.8372e-10 -4.0985e-14 -22593 -3.4808 4.7295 -0.0031933 4.7535e-05 -5.7459e-08 2.1931e-11 -21573 4.103
53 "CH2CHO " "SAND86" "O 1H 3C 2 " 300 1000 5000 5.9757 0.0081306 -2.7436e-06 4.0703e-10 -2.176e-14 490.32 -5.0453 3.4091 0.010739 1.8915e-06 -7.1586e-09 2.8674e-12 1521.5 9.5583

do yo want to calculate thermodynamic parameter? if yes enter 1 if No enter 0 =1
Enter the temperature of system between 300K to 5000 K in Kelvin scale=3250
The termodynamic properties at selected system temperature Tsystem-Specific heat(J/mol-K), Specifc enthalpy(J/mol) & Specific Entropy(J/mol-K)

GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

1 3250 "O " 21.004 3.1099e+05 211.33 -3.7582e+05 15.999

GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

2 3250 "O2 " 40.487 1.0817e+05 288.74 -8.3024e+05 31.999


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

3 3250 "H " 20.786 2.7935e+05 164.37 -2.5485e+05 1.0079


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

4 3250 "H2 " 37.6 98061 204.96 -5.6806e+05 2.0159


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

5 3250 "OH " 37.435 1.3846e+05 259.35 -7.0444e+05 17.007


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

6 3250 "H2O " 57.546 -99867 290.79 -1.0449e+06 18.015


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

7 3250 "HO2 " 60.875 1.6754e+05 343.13 -9.4764e+05 33.007


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

8 3250 "H2O2 " 79.516 67385 383.39 -1.1786e+06 34.015


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

9 3250 "C " 21.824 7.788e+05 208.29 1.0186e+05 12.011


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

10 3250 "CH " 41.887 7.049e+05 262.55 -1.4838e+05 13.019


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

11 3250 "CH2 " 55.81 5.3785e+05 302.75 -4.461e+05 14.027


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

12 3250 "CH2(S) " 55.945 5.7482e+05 296.75 -3.8962e+05 14.027


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

13 3250 "CH3 " 78.992 3.4493e+05 336.66 -7.4922e+05 15.035


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

14 3250 "CH4 " 113.61 1.8809e+05 365.9 -1.0011e+06 16.043


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

15 3250 "CO " 37.362 -7685.4 277.54 -9.0971e+05 28.01


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

16 3250 "CO2 " 62.473 -2.2511e+05 341.32 -1.3344e+06 44.01


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

17 3250 "HCO " 57.477 1.9402e+05 338.86 -9.0728e+05 29.018


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

18 3250 "CH2O " 80.106 94522 365.68 -1.0939e+06 30.026


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

19 3250 "CH2OH " 99.441 2.3905e+05 428.37 -1.1531e+06 31.034


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

20 3250 "CH3O " 103.75 2.7461e+05 407.55 -1.0499e+06 31.034


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

21 3250 "CH3OH " 122.52 1.0053e+05 452 -1.3685e+06 32.042


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

22 3250 "C2H " 63.73 7.3735e+05 341.52 -3.726e+05 25.03


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

23 3250 "C2H2 " 87.085 4.5035e+05 363.3 -7.3036e+05 26.038


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

24 3250 "C2H3 " 103.58 5.6156e+05 421.99 -8.0992e+05 27.046


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

25 3250 "C2H4 " 126.92 3.6634e+05 440.4 -1.065e+06 28.054


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

26 3250 "C2H5 " 146.66 4.8035e+05 501.9 -1.1508e+06 29.062


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

27 3250 "C2H6 " 170.13 3.3124e+05 518.89 -1.3552e+06 30.07


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

28 3250 "CH2CO " 104.45 2.24e+05 441.88 -1.2121e+06 42.037


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

29 3250 "HCCO " 80.951 3.9525e+05 409.79 -9.3656e+05 41.029


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

30 3250 "HCCOH " 108.09 3.6089e+05 443.2 -1.0795e+06 42.037


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

31 3250 "H2CN " 80.022 4.5453e+05 371.1 -7.5154e+05 28.037


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

32 3250 "HCN " 61.608 2.9217e+05 321.07 -7.513e+05 27.029


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

33 3250 "HNO " 66.44 2.7013e+05 337.23 -8.2587e+05 31.017


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

34 3250 "N " 21.099 5.3414e+05 203.09 -1.259e+05 14.01


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

35 3250 "NNH " 56.683 4.0084e+05 336.97 -6.9431e+05 29.028


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

36 3250 "N2O " 63.513 2.5283e+05 348.28 -8.7907e+05 44.019


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

37 3250 "NH " 39.031 4.5826e+05 258.61 -3.8221e+05 15.018


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

38 3250 "NH2 " 59.984 3.3993e+05 302.03 -6.4167e+05 16.026


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

39 3250 "NH3 " 79.727 1.4896e+05 329.34 -9.2138e+05 17.034


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

40 3250 "NO " 37.689 1.9574e+05 291.38 -7.5125e+05 30.009


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

41 3250 "NO2 " 61.791 1.9805e+05 362.82 -9.8112e+05 46.009


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

42 3250 "HCNO " 81.68 3.9186e+05 406.73 -9.3001e+05 43.028


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

43 3250 "HOCN " 77.365 1.961e+05 396.58 -1.0928e+06 43.028


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

44 3250 "HNCO " 81.085 98773 401.03 -1.2046e+06 43.028


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

45 3250 "NCO " 61.588 3.0194e+05 361.27 -8.7218e+05 42.02


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

46 3250 "CN " 42.908 5.4663e+05 283.53 -3.7485e+05 26.021


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

47 3250 "HCNN " 81.301 6.8256e+05 415.62 -6.682e+05 41.039


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

48 3250 "N2 " 37.172 1.0201e+05 270.09 -7.758e+05 28.02


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

49 3250 "AR " 20.786 61358 204.39 -6.029e+05 39.948


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

50 3250 "C3H8 " 238.52 4.8195e+05 670.5 -1.6972e+06 44.097


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

51 3250 "C3H7 " 214.83 6.3218e+05 656.01 -1.4998e+06 43.089


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

52 3250 "CH3CHO " 147.68 2.047e+05 523.05 -1.4952e+06 44.053


GAS_PARAMETERS =

1×8 table

Sr Tsystem selected_gas gas_specific_heat gas_specific_enthalpy gas_specific_entropy gas_specific_gibbs_free_energy molecular_mass
__ _______ ____________ _________________ _____________________ ____________________ ______________________________ ______________

53 3250 "CH2CHO " 124.43 3.4281e+05 493.74 -1.2618e+06 43.045

>>

2.3. SCREENSHOTS

OUTPUT SCREENSHOT

GAS PARAMETERS

PLOT DATA

PLOT SAVING FOLDER SCREENSHOT

CITATION

Understanding the data structure

1.Understanding the NASA Thermodynamic data formatting method- pdf link-https://shepherd.caltech.edu/EDL/PublicResources/sdt/formats/nasa.html

2.Understanding the NASA data of ideal gas thermodynamic properties in chemkin format- site link for pdf- https://jingweizhu.weebly.com/uploads/1/3/5/4/13548262/ideal_gas_thermodynamic_properties_in_chemkin_format.pdf

3.Book to refer the chemkin plot data - https://www.osti.gov/servlets/purl/7073290

4.Check thermodynamic values - http://combustion.berkeley.edu/gri-mech/data/thermo_table.html

5.Basic of table in MATLAB-youtube video- https://www.youtube.com/watch?v=SbR5_i4UY0w

6.Convert string to number youtube video- https://www.youtube.com/watch?v=DdOPybjKpkE

7.MATLAB Video 4: Basic Strings, Concatenating Strings, and Char Function-youtube video- https://www.youtube.com/watch?v=NlUCU-0MXn4

8.MATLAB/Otave for Beginners- Extracting Data From Tables, Matrices and Vectors -youtube video- https://www.youtube.com/watch?v=lh10T_uWIak

9.Use of subplot command-youtube video- https://www.youtube.com/watch?v=BO5tqj_0bKQ

10.To save multiple plot in folder by Moninka Shivhare- https://www.mathworks.com/matlabcentral/answers/403782-how-can-i-save-multiple-plots-in-a-specified-folder

Use of commands


1.Use of fprint f command - https://www.mathworks.com/help/matlab/ref/fprintf.html

2.Use of split line command- https://www.mathworks.com/help/matlab/ref/splitlines.html

3.Use of convert character to trings command - https://www.mathworks.com/help/matlab/ref/convertcharstostrings.html

4.Use of switch case command - https://www.mathworks.com/help/matlab/ref/switch.html

5.Use of extract Between command - https://www.mathworks.com/help/matlab/ref/extractbetween.html

6.Use of table commands - https://www.mathworks.com/help/matlab/ref/table.html

7.Use of concatenate array - https://www.mathworks.com/help/matlab/ref/double.cat.html

8.Use of text to number command - https://www.mathworks.com/help/matlab/matlab_prog/converting-from-string-to-numeric.html

9.USE OF ACCESS DATA IN TABLE - https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-table.html

10.Use of cell to array(mat) command - https://www.mathworks.com/help/matlab/ref/cell2mat.html

11.Use of switch case command - https://www.mathworks.com/help/matlab/ref/switch.html

12.Determine array element not a number - https://www.mathworks.com/help/matlab/ref/isnan.html

13.Determine array element a number - https://www.mathworks.com/help/matlab/ref/isnumeric.html

14.Use of while loop - https://www.mathworks.com/help/matlab/ref/while.html

NASA Thermodynamic data file via skill lync- https://drive.google.com/file/d/1AikCHDlz9s_fu8whE81qee_GD4AyYpCP/view

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.