Iteration for one column of linprog inequality constraint

2 views (last 30 days)
Hi I have the following code
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)];
f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+sum(hourly_cost(z))] % how do we manipulate diesel cost?
b = -Demand;
[x,fval,exitflag] = linprog(f,A,b,[],[],lb,ub)
end
What I am tying to do is iterate the "Diesel_supply" from the "Diesel_matrix" which is a 21x1 matrix with the respective cost.
The PV_supply and WT_supply are 24x1 size of known values. It is the "Diesel_supply" values that should be 24x1 but I don't know what the values are - what I do know is that each value of the 24 comes from the "Diesel_supply" column and that is why Im trying to iterate.
As the code stands there are dimensional errors on matrix "A" as I think the for loop is not iterating correctly and am wondering if anyone knows how to correct the code for the for loop

Answers (0)

Community Treasure Hunt

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

Start Hunting!