MATLAB: How to apply multiple in mintutes for loops to 365 days

time scaletime series

I am new in MATLAB and I need a help to calculate resistance growth for a battery for one year and then estimation how many years does need to reach 200% of its initial value. If I have an equation for it in for loop for different uses a day, how can apply those uses in minutes to 365 days?
For example,
for i=1:365 %one year
for j=1:720 % using the battery for the half of day (in minutes)

time_1= ??? % here is the place to link i and j ????
R_1= x*time_1;%resistance growth for the first use
end
for k=721:1440 % using the battery for the half of day (in minutes)
time_2= ???? %here is the place to link i and k
R_2= x*time_2;%resistance growth for the second use
end
end
Any idea which helps will be appreciated. Thank you in advance!

Best Answer

Muapper - so you will need two arrays: one for each minute for every day of the year, and one array for the resistance per day. Something like
resistanceByMinute = zeros(1440*365,1);
resistanceByDay = zeros(365,1);
You would update these arrays in the following manner
for d=1:365
for m=1:720
resistanceValue = ...; % something
resistanceByMinute((d-1)*1440 + m) = resistanceValue;
end
for m=721:1440
resistanceValue = ...; % something
resistanceByMinute((d-1)*1440 + m) = resistanceValue;
end
resistanceByDay(d) = resistanceByMinute((d-1)*1440 + 1440);
end
The above assumes that you want the resistance value calculated on the last minute of the day to be the resistance value for the day.