As shown below, my function can only plot dots instead of solid lines, do anyone knows why? Thank you
%Finding indoor temperature
function [dTin] = getTin_00(Tin) %Input of function should be Tin = 5 and Theater = 40 normally
dt =0.1; m = 4.9; Tout = 5; Theater = 40; M = 0.25; c = 1005.4; Ar = 2.8197; Aw = 10.2042; Uwall = 0.0069; Uroof = 0.0179; dQheater = (Theater-Tin)*M*c*dt; dQloss = (Tin-Tout)*Ar*Uroof*dt+(Tin-Tout)*Aw*Uwall*dt; dTin = (dQheater - dQloss)/(m*c); for t = 0:0.1:200 %increment 0.1 is equal to dt
dQheater = (Theater-Tin)*M*c*dt; dQloss = (Tin-Tout)*Ar*Uroof*dt+(Tin-Tout)*Aw*Uwall*dt; dTin = (dQheater - dQloss)/(m*c); Tin = Tin+dTin; if Tin <= 21 Theater = 40; end if Tin >= 24 Theater = 0; end figure(1); plot(t,Tin,'.r'); title('The change in temperature over 200 seconds'); xlabel('Time'); ylabel('Internal temperature'); hold on; grid on; axis tight; disp(Tin) end end
Best Answer