How can I change this code to form a continuous plotted line?
Show older comments
All I get are invisible plots unless I change then, for example, to circles then I can see them. But this is not very neat nor what I need. What do I need to change?
b_v = 3.7; % volts of battery
b_a = 24000e-03; % 6000 mA x 4 cells
b_r = 3.5e-03; % resistance of battery, 1-7 mOhms
t_sun = 1; % time in the sun
t_ecl = 1; % time in eclipse
t_on = 800; % longest time for battery to be on, s
t_off = 228; % shortest time for battery to be on, s
m_2U = 2.66; % mass of a 2U cubesat, kg
shc_b = 879.2; % specific heat of battery
shc_g = 130; % specific heat capacity of gold
A_s = 0.1*0.1*2+0.1*0.227*4; % surface area of 2U
p_l = 1/4; % fraction of long side are louvers, 0.1*0.227 sides
A_l = p_l*0.1*0.227; % surface of area of louvers
A_sl = A_s - A_l; % surface area that are not the louvers
sigma = 5.67e-08; % Boltzmann constant
e_g = 0.04; % emissivity of gold
e_b = 1; % ideal black body emissivity
T_cub_n = 333; % cubesat starting temperature, kelvin, 50 C
T_cub_l = 333; % cubesat starting temperature with louvers, 50 C
%% Variables
for t = 1:20
% without louvers open
Q_n(t) = sigma*e_g*A_s*-(T_cub_n(t)^4); % Heat without louvers
dT_n(t) = Q_n(t)/(shc_g*m_2U); % change in temperature per second
T_cub_n(t+1) = T_cub_n(t) + dT_n(t);
% with louvers open
Q_l(t) = sigma*e_b*A_l*-(T_cub_l(t)^4)+sigma*e_g*A_sl*-(T_cub_l(t)^4); %heat with louvers
dT_l(t) = Q_l(t)/(shc_g*m_2U); % change in temperature per second
T_cub_l(t+1) = [T_cub_l(t) + dT_l(t)];
time = t - 1;
plot(time, T_cub_n(t), 'r')
xlabel('Time (s)')
ylabel('Temperature (K)')
title('Temperature of CubeSat')
hold on
plot(time, T_cub_l(t), 'b')
end
Accepted Answer
More Answers (0)
Categories
Find more on Weather and Atmospheric Science in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!