Project 1 - Parsing NASA thermodynamic data
AIM:- Parsing NASA thermodynamic data
- Writing MATLAB coding for reading a NASA thermodynamic data file.
- Coding of extracting the coefficient from the file.
- Coding of calculating thermodynamic properties with the help of extracting co-efficient for a particular species.
- Calculate the molecular weight of each species and display it in the command window.
- Coding of saving the plots as images with appropriate names and dumping them in separate folders for each species with a suitable name. All these will be generated automatically.
Molecular mass Function Codding:
function [M]=molecular_mass(molecule_name);
fprintf('Molecular weight of ');
fprintf(molecule_name);
fprintf(' : ');
atoms=['h','C','N','O','R'];
%R is for argon molecule and not use ()these small brackets.
atom_weight=[1 12 14 16 40];
M=0;
for i=1:length(molecule_name);
for j=1:length(atoms)
if strcmpi(molecule_name(i),atoms(j));
%strcmp means string comparision .it is used for checking that both elements are same or not. and by use strcmpi here,it take doesn't matter about elements are capital letter or small Example'h' =='H'means case insensitive condition.
M=M+atom_weight(j);
position=j;
% here, we are storing the position of corrected match molecule characters to the atoms
end
end
n= str2num(molecule_name(i));
%this all proces is doing for a number multiplier in molecule name.so the value of n will be come same as a number value present in that string name
if n > 1
M=M+atom_weight(position)*(n-1);
%here we are taking (n-1) in multiply instead of n because we are input second time coding M=M+atom_weight.so by this two times mass add so to over come this we are reducing n to n-1 time
end
end
fprintf('%d',M);%d is for digit
disp(' ')
%it is not necessary command disp which refers to display, space (' ').But it for second time running the program because it separates the molecular weight statements to additional matlab warning statements like directory is already exist.
end
Plots of O2:
Plots of N2:
Plots of CO2: