Indexing into a matrix to create a plot
2 次查看(过去 30 天)
显示 更早的评论
I would like to store Tskin for all t values and then use indexing to create a plot. How do I accomplish this?
Tambient = 20; % C
Tfilm = (T + Tambient)/2;
T = 29;
for t = 1:1:10
k_air_2 = 0 * (2.4131 + 0.0078 * T) * 10^-2; % W/m*C = 0
k_cotton = 0; % because long sleeve
rho_air = 1.2893 - 0.004 * Tfilm; % kg/m^3
mu_air = (0.0047 * Tfilm + 1.7164) * 10^-5; % kg/m*s
k_air_ambient= (2.4131 + 0.0078 * Tfilm) * 10^-2; % W/m*C
Re = Diameter_forearm * V * rho_air / mu_air;
h_air = (k_air_ambient/Diameter_forearm) * (0.3 + ((0.62 * Re.^.5 * Pr.^.333)/((1 + (0.4 * Pr)^.667).^.25))*(1 + ((Re/282000).^(5/8))).^.8) % J/s*K*m^2
Uskin = (k_air_2/thickness_air) + (k_cotton/thickness_shirt) + (h_air) % J/s*K*m^2
Uambient = (k_air_ambient/thickness_air) + (k_cotton/thickness_shirt) + (h_air)
old_Tskin = T
Tskin = [(T * Area * Cp_air * rho_air)/(t-(t-1)) + Qgen + (Uambient * Area * Tambient)]/((Area * Cp_air * rho_air / ((t-(t-1)))) + Uskin * Area);
T = Tskin
Tfilm = (T + Tambient)/2;
fprintf('Your frontal forearm temperature is %.2f C after %d seconds ' ,Tskin,t)
dT = old_Tskin - Tskin
if dT > 0.007
display('Your forearm probably feels cold')
elseif dT < -0.005
display('Your forearm probably is probably feeling hot')
else
display ('Your forearm feels comfortable')
end
end
2 个评论
Ameer Hamza
2020-3-29
Several variables in your code are not defined. Please specify the values of all variables.
回答(1 个)
MaryD
2020-3-29
you can just try
T_skin(t)= [(T * Area * Cp_air * rho_air)/(t-(t-1)) + Qgen + (Uambient * Area * Tambient)]/((Area * Cp_air * rho_air / ((t-(t-1)))) + Uskin * Area);
inside the loop.
then outside the loop
t=1:1:10
plot(t,T_skin)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!