Graph does not plot/show zero-zero points

8 visualizaciones (últimos 30 días)
neutronhammer
neutronhammer el 15 de Feb. de 2020
Hello there,
I'm trying to plot two 1-D arrays, Time_value vs Charge_value, however I can't get the plot to display all the points, specifically the 0-0 points.
Time_value and Charge_value are arrays with 24 data points with 22 non-zero values each. I'd like to have the 0 vs 0 points displayed on the x-axis as well ith he non-zero values being the peaks.
E_Cap= 15.7; %kWh
SOC_End= 100; % percentage
SOC_Start= 0; % percentage
T_Char= 0.1769; % h/kWh
for i = 1:1
z = randi(100);
Minutes = randi(60);
%Arrival times
if z <= 1.1
T_Arr = 0;
elseif z <= 1.2
T_Arr = 60;
elseif z <= 1.3
T_Arr = 120;
elseif z <= 2.2
T_Arr = 180;
elseif z <= 3.5
T_Arr = 240;
elseif z <= 5.5
T_Arr = 300;
elseif z <= 9.5
T_Arr = 360;
elseif z <= 14.1
T_Arr = 420;
elseif z <= 17.7
T_Arr = 480;
elseif z <= 21.1
T_Arr = 540;
elseif z <= 26
T_Arr = 600;
elseif z <= 32.9
T_Arr = 660;
elseif z <= 38.3
T_Arr = 720;
elseif z <= 43.4
T_Arr = 780;
elseif z <= 48.5
T_Arr = 840;
elseif z <= 55.2
T_Arr = 900;
elseif z <= 64.3
T_Arr = 960;
elseif z <= 74.4
T_Arr = 1020;
elseif z <= 81.5
T_Arr = 1080;
elseif z <= 88.3
T_Arr = 1140;
elseif z <= 92.6
T_Arr = 1200;
elseif z <= 96.7
T_Arr = 1260;
elseif z <= 99
T_Arr = 1320;
else
T_Arr = 1380;
end
T_Arr = T_Arr + Minutes;
T_Arr = T_Arr/60;
T_Arr = round(T_Arr);
%Calculation of the end time of the charging process
E_Char = E_Cap * (SOC_End-SOC_Start)/100;
T_Dur = E_Char*T_Char;
T_End = T_Arr+T_Dur;
T_End = round(T_End);
Time_value=zeros(1,24);
Time_value(T_Arr)=T_Arr;
Time_value(T_End)=T_End;
Charge_value=zeros(1,24);
Charge_value(T_Arr)=E_Char;
Charge_value(T_End)=E_Char;
end
disp(Time_value)
disp(Charge_value);
scatter(Time_value,Charge_value,'o')

Respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by