MATLAB Answers

Iteration for one column of linprog inequality constraint

2 views (last 30 days)
Andrew Alkiviades
Andrew Alkiviades on 11 Jul 2012
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)
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


Sign in to comment.

Answers (0)

Sign in to answer this question.

Translated by