Challenge

Project 1 - Parsing NASA thermodynamic data

Sir/mam I have used pireted version of matlab and in one one one setion with sir, told me that some of graphs are inverted

due to that reason and molecular weigth is not print in command window so i have created new file to save it.

error i got-

not able to see data of molecular weight in command window due to software piracy

to overcome- created new directory and created notepad fine to save molecular weight data.

%nasa project
clear all 
close all 
clc
%Now to read the data in our file we are providing 'fT' variabble to store
%the data of our file in matlab and to open our file we have used fopen
%command with veriable 'r' to read the command.

fT=fopen('THERMO.dat','r');
fgetl(fT)
%now we have used fgetl command to call our file this will read the header
%information of the file so after the run we can see the header of the file
%is printed in workspace
A=fgetl (fT)
%but to move ahead we have to take other data of filr in the input so to do
%that with help of video course we are going to use sring and string split
%command to take further data
A=strsplit(A,' ');
glob_low_temp=str2num(A{2});
glob_mid_temp=str2num(A{3});
glob_high_temp=str2num(A{4});
%now we have to skip next 3 lines by using f get l command
fgetl(fT);
fgetl(fT);
fgetl(fT);
%now we are going to take next line in cosideration which contains name of
%the species and the local temprature of scpecies
for i=1:53
B=fgetl(fT)
B=strsplit(B,' ');
species_name=B{1};       % here we have taken out the name of the species
local_low_temp=str2num(B{end-3});
local_high_temp=str2num(B{end-2});
local_mid_temp=str2num(B{end-1});

t1=local_low_temp;
t2=local_mid_temp;
t3=local_high_temp;
%now we are taking our next inputs to cosideration
L1=fgetl(fT)                     %this provision of line to our veriables

a=findstr(L1,'E')                %here we have searched comman veiable in
                                 %our all valunes
                                 
a1=L1(1:a(1)+3)                  %now we have cosidered a as a string and 
                                 %from a we have separated all the veriables

a1=str2num(a1)                   % and to convert our string to the number 
                                 %we have use str2num command
a2=L1(a(1)+4:a(2)+3);
a2=str2num(a2);
a3=L1(a(2)+4:a(3)+3);
a3=str2num(a3);
a4=L1(a(3)+4:a(4)+3);
a4=str2num(a4);
a5=L1(a(4)+4:a(5)+3);
a5=str2num(a5);
%now we have to follow the same procedure to get data from all lines so to
%do tha fowe are going to follow the same steps as above.
L2=fgetl(fT)                     %this provision of line to our veriables

b=findstr(L2,'E')                %here we have searched comman veiable in
                                 %our all valunes
                                 
a6=L2(1:b(1)+3);                  %now we have cosidered a as a string and 
                                 %from a we have separated all the veriables

a6=str2num(a6)  ;                 % and to convert our string to the number 
                                 %we have use str2num command
a7=L2(b(1)+4:b(2)+3);
a7=str2num(a7);
a8=L2(b(2)+4:b(3)+3);
a8=str2num(a8);
a9=L2(b(3)+4:b(4)+3);
a9=str2num(a9);
a10=L2(b(4)+4:b(5)+3);
a10=str2num(a10);

L3=fgetl(fT)                     %this provision of line to our veriables

c=findstr(L3,'E')                %here we have searched comman veiable in
                                 %our all valunes
                                 
a11=L3(1:c(1)+3);                  %now we have cosidered a as a string and 
                                 %from a we have separated all the veriables

a11=str2num(a11) ;                  % and to convert our string to the number 
                                 %we have use str2num command
a12=L3(c(1)+4:c(2)+3);
a12=str2num(a12);
a13=L3(c(2)+4:c(3)+3);
a13=str2num(a13);
a14=L3(c(3)+4:c(4)+3);
a14=str2num(a14);
% this is how we got all the values from the perticular species

T=linspace(t1,t3,100)
R=8.314;
%Calculation of upper and lower temprature
%now we are going to use for loop for calculation because we are going to
%use it for 53 species so we are using it repeatedly.
for x=1:length(T)
    if T(x)1
        molecular_weight= molecular_weight+Weight_of_mol(position)*(n-1);
    end
    cd
    
end
f2=fopen('species_list.txt','a');
   %printing molecular mass
   
   fprintf(f2,'%s:%f u',species_name,molecular_weight);

   
   fclose(f2);
end
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.