Parsing NASA Thermodynamic Data
https://drive.google.com/file/d/1J3d-HCJ1UKbsS0uRaWTVVVwbIrXuPC5x/view?usp=sharing
https://drive.google.com/file/d/1J3d-HCJ1UKbsS0uRaWTVVVwbIrXuPC5x/view?usp=sharing
check out this link. it contains .m file named as polynomial.
clear all
close all
clc
%inputs and temperature variables
R=8.14;
%gas constant
k=0;
%Main loop governor
low_temp=200;
%partition between high temperature and low temp
%open file
FID=fopen(\'therm.dat\');
for i=1:5
line=fgets(FID); %eliminated inital lines
end
t=linspace(0,1000,100); %creating a temperature array
while k==0 %main loop
line=fgets(FID);
a=sscanf(line,\'%c\');
%checking for end
c=a(1:3);
d=\'END\';
if c==d
break
end
%finding molecular mass
p=25;
mol_mass=0;
for i=0:2
p=p+5*i;
g=str2num(a(p+4));
switch a(p)
case \'O\'
mol_mass = mol_mass + 16*g ;
case \'H\'
mol_mass=mol_mass+2*g;
case \'N\'
mol_mass=mol_mass+14*g;
case \'C\'
mol_mass=mol_mass+12*g ;
case \'A\'
mol_mass=mol_mass+40*g;
otherwise
break
end
end
s=0;
s=num2str(mol_mass) ;
%naming the substance with molecular mass
for i=1:9
if a(i)==\' \\\'
b(i)=\'_\';
end
b(i)=a(i);
end
if length(s)==2
b(10:11)=s;
else
b(10)=\'_\';
b(11)=s;
end
%inputing next 3 lines
line=fgets(FID);
a1=sscanf(line,\'%f\');
line=fgets(FID);
a2=sscanf(line,\'%f\');
line=fgets(FID);
a3=sscanf(line,\'%f\');
%obtain constant in two array h for high temp and l for low temp
% here low temp is assumed to be any temperature below 200K
h=[a1(1) a1(2) a1(3) a1(4) a1(5) a2(1) a2(2)];
l=[a2(3) a2(4) a2(5) a3(1) a3(2) a3(3) a3(4)];
%thermal properties calculation
for i=1:length(t)
if t(i)
https://drive.google.com/file/d/1J3d-HCJ1UKbsS0uRaWTVVVwbIrXuPC5x/view?usp=sharing
for i=1:length(t)
if t(i)
%%%%%%%%%%%Please post the code again without errors