Hi I have the following code which I believe have indexed wrongly and so Im not getting the answer I am looking for
Diesel_matrix = xlsread('test_diesel.xlsx','Sheet2'); Diesel_supply = Diesel_matrix(:,1); % Power output of diesel generator hourly_cost = Diesel_matrix(:,2); % Diesel cost of running genreator at that output for z = 1:21 A = [-PV_supply -WT_supply -Diesel_supply(z)*ones(24,1)]; f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+sum(hourly_cost(1:z))] ; b = -Demand; [x,fval,exitflag] = linprog(f,A,b,,,lb,ub) end
I am trying to loop only for the third column of matrix A. I would like to loop for all the rows in "Diesel_supply" per row of matrix A
at the moment, the code works for 21 sets of x outputs but column 3 is either row 1,2,3 etc up to row 21 of "Diesel_supply". Wheras I am trying to get it for row 1 and 2 and 3 and 4 etc up to row 21 of "Diesel_supply". This will allow me to examine all the elements in "Diesel_Supply"