i have a txt file with ‘temp’ and ‘heat flux’ and i need to use it to calculate final temp and optimum emissivity. my code runs fine but the output file is coming out blank?
C1 = 3.74177e8;
C2 = 1.43878e4;
sig = 5.67e-8;
T_static = 229.58;
Tval = fopen(‘radiative boundary.txt’, ‘r’);
Tvalue = fscanf(Tval, ‘%f’);
fclose(Tval);
T = Tvalue;
H = hvalue;
Temp_value = [];
optimum_emsvty = [];
Temp_value = Temp_value;
optimum_emsvty = optimum_emsvty;
for i = 1:length(H)
e0 = 0.0;
e1 = 1.0;
delt = 1;
while abs(delt) > 0.000001
e = (e0 + e1) / 2.0;
c = 500;
for j = 1:5
c = c – wall(c, i, T, H, e, sig, T_static) / derivative(@wall, c, 1e-6, i, T, H, e, sig, T_static);
end
powr = integral(@(lam) power(lam, C1, C2, e), 8, 12);
delt = powr – integral(@(lam) power(lam, C1, C2, 1), 8, 12);
if delt > 0
e1 = e;
elseif delt < 0
e0 = e;
end
end
c = double(c);
end
writematrix(optimum_emsvty,’Optimum_Emissivity.txt’);
writematrix(Temp_value,’Final_Wall_Temperature.txt’);
function powr = power(lam, C1, C2, e)
powr = (e * C1) / ((lam^5) * (exp(C2 / (lam * T_static)) – 1));
endC1 = 3.74177e8;
C2 = 1.43878e4;
sig = 5.67e-8;
T_static = 229.58;
Tval = fopen(‘radiative boundary.txt’, ‘r’);
Tvalue = fscanf(Tval, ‘%f’);
fclose(Tval);
T = Tvalue;
H = hvalue;
Temp_value = [];
optimum_emsvty = [];
Temp_value = Temp_value;
optimum_emsvty = optimum_emsvty;
for i = 1:length(H)
e0 = 0.0;
e1 = 1.0;
delt = 1;
while abs(delt) > 0.000001
e = (e0 + e1) / 2.0;
c = 500;
for j = 1:5
c = c – wall(c, i, T, H, e, sig, T_static) / derivative(@wall, c, 1e-6, i, T, H, e, sig, T_static);
end
powr = integral(@(lam) power(lam, C1, C2, e), 8, 12);
delt = powr – integral(@(lam) power(lam, C1, C2, 1), 8, 12);
if delt > 0
e1 = e;
elseif delt < 0
e0 = e;
end
end
c = double(c);
end
writematrix(optimum_emsvty,’Optimum_Emissivity.txt’);
writematrix(Temp_value,’Final_Wall_Temperature.txt’);
function powr = power(lam, C1, C2, e)
powr = (e * C1) / ((lam^5) * (exp(C2 / (lam * T_static)) – 1));
end C1 = 3.74177e8;
C2 = 1.43878e4;
sig = 5.67e-8;
T_static = 229.58;
Tval = fopen(‘radiative boundary.txt’, ‘r’);
Tvalue = fscanf(Tval, ‘%f’);
fclose(Tval);
T = Tvalue;
H = hvalue;
Temp_value = [];
optimum_emsvty = [];
Temp_value = Temp_value;
optimum_emsvty = optimum_emsvty;
for i = 1:length(H)
e0 = 0.0;
e1 = 1.0;
delt = 1;
while abs(delt) > 0.000001
e = (e0 + e1) / 2.0;
c = 500;
for j = 1:5
c = c – wall(c, i, T, H, e, sig, T_static) / derivative(@wall, c, 1e-6, i, T, H, e, sig, T_static);
end
powr = integral(@(lam) power(lam, C1, C2, e), 8, 12);
delt = powr – integral(@(lam) power(lam, C1, C2, 1), 8, 12);
if delt > 0
e1 = e;
elseif delt < 0
e0 = e;
end
end
c = double(c);
end
writematrix(optimum_emsvty,’Optimum_Emissivity.txt’);
writematrix(Temp_value,’Final_Wall_Temperature.txt’);
function powr = power(lam, C1, C2, e)
powr = (e * C1) / ((lam^5) * (exp(C2 / (lam * T_static)) – 1));
end output file blank MATLAB Answers — New Questions