Interpolation on Thermodynamics tables

3 views (last 30 days)
SERHAT GÜR
SERHAT GÜR on 8 Apr 2021
Hi, I have a question about filling table with know a base table and some NaN values changing to their other known values of interpolation. So, I added my code but I don't know how can i use the superheated table and also as you can see on below I have to learn about loops but I can not applying on this code. If you can help me, I will be very happy. I will adding the tables and also project guides.
%Filling of Table with data txt
tablo=importdata('saturated_2.txt');
super = importdata('SuperheatedWaterTableSI.mat');
temp_sat = tablo(:,1);
pressure= tablo(:,2);
vf_sat=tablo(:,3);
vfg_sat=tablo(:,4);
vg_sat=tablo(:,5);
uf_sat=tablo(:,6);
ufg_sat=tablo(:,7);
ug_sat=tablo(:,8);
hf_sat=tablo(:,9);
hfg_sat=tablo(:,10);
hg_sat=tablo(:,11);
sf_sat=tablo(:,12);
sfg_sat=tablo(:,13);
sg_sat=tablo(:,14);
%Given parameters must have known about the program
t=[200;143;314;NaN;NaN;500;733;981];
p=[NaN;NaN;NaN;536;1287;1258;1000;1678];
x=[0.78;NaN;NaN;NaN;NaN;NaN;NaN;NaN];
nu=[NaN;0.094;NaN;NaN;NaN;NaN;NaN;NaN];
u=[NaN;NaN;2000;NaN;NaN;NaN;NaN;NaN];
h=[NaN;NaN;NaN;2633;NaN;NaN;NaN;NaN];
s=[NaN;NaN;NaN;NaN;6.1;NaN;NaN;NaN];
xtable = table(t,p,x,nu,u,h,s);
check=ismissing(xtable);
val1 = ismember(t,temp_sat);
i = find(temp_sat == t(1));
%then
np=pressure(i);
nvf=vf_sat(i);
nvg=vg_sat(i);
nuf=uf_sat(i);
nug=ug_sat(i);
x1 = x(1,1);
u = nuf +x1*(nug-nuf);
v = nvf + x1 * (nvg - nvf);
fprintf('%.2f %.2f %.6f %.6f %.6f %.6f %.6f \n' ,t(1),np,x1,v,nvf,nvg,u)
P = 536; %kpa
A = find(pressure<p(4));
j = A(end);
B = find(pressure>p(4));
k = B(1);
P1 = pressure(j);
P2 = pressure(k);
T1=temp_sat(j);
T2=temp_sat(k);
vf1=vf_sat(j);
vf2=vf_sat(k);
uf1=uf_sat(j);
uf2=uf_sat(k);
hf1=hf_sat(j);
hf2=hf_sat(k);
int_t = ((P-P1)*(T2-T1))/(P2-P1)+T1;

Answers (0)

Categories

Find more on Thermal Analysis in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!