How can I make this fucntion loop into a vector of three different "tempexperimental" (temperatures). and to loop to a rage of densities," pexperimental" form .55:.885

1 Ansicht (letzte 30 Tage)
function [ X, proof] = TrueProof(pexperimental, tempexperimental)
TTB1 = xlsread('TTB_Table_1_digitized.xlsx');%,'B7:CW213');
TTB6 = xlsread('TTB_Table_6_digitized.xlsx');%,'A7:E206');
p2 = pexperimental.*(1+((25*10^-6)*(tempexperimental-60)));% adjusting the density to 60F
pw = 0.9994; %
sg = p2/pw; %
%TTB6 columns
C = TTB6(:,1);%
Alcohol = TTB6(:,2);%
Water = TTB6(:,3);%
spAir = TTB6(:,4);%
spVacuum = TTB6(:,5);%
%interpulate table 6 for loop
C2 = interp1(spAir,C,sg);
TTB1(isnan(TTB1))= 0;
TR = floor(tempexperimental); %rounding down the experimental temp
CR = floor(C2); %rounding down to proof found for C2
IR = find(abs(TTB1(:,1)-CR)<0.1, 1,'first');%interpulated row -> (IR) for proof
IC = find(abs(TTB1(1,:)-TR)<0.1, 1,'first');%Interpulated colunm -> (IC) for temperature
%finding the derivative of coumn vector and row vector for the specific
%range
% dfdC = diff(TTB1(IR,:));%df/dC derivative of proof
% dfdT = diff(TTB1(:,IC));%df/dT derivative of temperature
dzdC = diff(TTB1(IR,:)); %df/dC derivative of proof
dzdT = diff(TTB1(:,IC));%df/dT derivative of temperature
dC=dzdC(IC);
dT=dzdT(IR);
f = TTB1(IR,IC);
C3 =(f+((C2-CR)*dC)+((tempexperimental-TR)*dT));%taylor series for true proof function
%interpulating table 6 with the C3 values (true proof at 60F)
%Tww = interp1(C,TTB6(:,2:end),C3);% volume of water %v/v
Tww = interp1(C,Water,C3);
Ethenolww = interp1(C,Alcohol,C3);
%percent volume of alcohol %v/v
alcpercent = C3./2;%mass fraction of ethanol
peth= 0.79313; %density of ethanol [g/cc] at 60F
%massF = (alcpercent.*peth)/((alcpercent.*peth)+(Tww.*pw));
%Mole fraction of ethanol
MWeth = 46.06844;%molar mass of ethanol [g/mol]
MWwat = 18.01528;%molar mass of water [g/mol]
moleFraction =((Ethenolww.*peth)/MWeth)/(((Ethenolww.*peth)/MWeth)+((Tww.*pw)/MWwat));%Ethanol mole fraction
% the outputs
X = moleFraction %mole fraction of ethanol
proof = C3 %proof corrected at 60F
end

Antworten (0)

Kategorien

Mehr zu Chemistry finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by