我有下面的代码,我试图从非零数开始“number_panels”和“number_turbines”for循环。
更具体地说,我正在尝试 3000 到 4000 个“number_panels”,500 个面板间隔和 5 到 8 个“number_turbines”,一个涡轮机间隔,即
number_of_days = 2;
for number_panels = 3000:500:4000 % range of PV panel units examined
for number_turbines = 5:8 % range of wind turbine units examined
for h=1:24 %# hours
for d = 1:number_of_days %# which day
n = h + 24*(d-1);
% hourly_deficit_1(...,..., h, d)= Demand(n)-(PV_supply(n)... %
hourly_deficit(number_panels + 1, number_turbines + 1, h,d) = hourly_annual_demand(n) - (hourly_annual_PV(n)*number_panels) - (hourly_annual_WT(n)*number_turbines);% hourly power deficit (RES supply with demand)
if hourly_deficit(number_panels + 1, number_turbines + 1, h,d)< 0 % zero out negative hourly deficit values (this is power surplus from RES)
hourly_deficit(number_panels + 1, number_turbines + 1, h,d) = 0;
end
当我这样做时,我得到一个 size(hourly_deficit) = 4001,9,24,2 而我期待并试图达到 3,4,24,2 的大小。有谁知道我哪里出错了?