hi I am working with the brute force method that I have shown in the code below.
the size of PV_supply, WT_supply and Demand are all 48×1.
what I am tying to do is calculate the “hourly_deficit” equation for n = 1:24 and n = 25:48 separately so as to output 2 “sets” of “hourly_deficit”
My code is
for number_panels = 0:5
for number_turbines = 0:3
for n = 1:24:48 % number of hours per day
hourly_deficit(number_panels + 1, number_turbines + 1, n) =...
Demand(n) - (PV_supply(n)*number_panels) - (WT_supply(n)*number_turbines);
end
end
end
I was hoping on some help with how I should adapt the for loop so as to get the results as I am looking for. As it stands, the for n = 1:24:48 only actually goes up to n = 24
Thank you
1:24:48means “from 1 by increments of 24 until 48”: The values therefore would be1 25 49...if you kept the series going. Since49is outside the bounds you defined, it stops at25.One solution for doing what you want would be the following:
To generalize for any number of days, add a 4th dimension to the matrix. Third dimension would be hour (1:24), 4th would be day.