Clear Filters
Clear Filters

Indexing input must be numeric, logical or ':'.

1 view (last 30 days)
function [x] = cost1(x)
mtgb=x(1);
pafcb=x(2);
utilityb=x(3);
%objective function =mt+pafc+pv+wt+bat+utility=PL(load demand)
run('E:\my project\wt.m')
for i=1:24
k=x(1)+x(2)+x(3)+a(i)+c(i);
bat=30;
if k+bat>=l(i)
display('load demand is met')
rem=k-l(i)+bat
else
display('load demand is not met')
k+bat>=l(i)
rem=l(i)-k-bat
end
end
%calculation of cost for the generation
%As of now we are neglecting the start up cost and shut down cost
% considering only bid cost for the different utilities
for i=1:24
m(i)=(x(1)*0.457+x(2)*0.294+x(3)*b(i)+a(i)*1.073+c(i)*2.584+bat*0.38)
end
end
i want to run it in gatool nd want to get the best values
  1 Comment
David Young
David Young on 9 Sep 2014
Please format the code in your question. Put two spaces at the start of each line, or select it and use the "{} Code" button.

Sign in to comment.

Answers (1)

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh on 9 Sep 2014
Hi Aditya,
I guess your problem is in the line below
m(i)=(x(1)*0.457+x(2)*0.294+x(3)*b(i)+a(i)*1.073+c(i)*2.584+bat*0.38)
It would be good if you could tell us, in which line the error exist, you normally should get this information from the prompted error.
I guess x(l) is the problem
Apparently you have a variable named l (is L not one(1)), which may have non integer values. You're using l (L) to refer to x indexes, so you should make sure L values are all integer and grater than 0, not even 0.
Check L values and let us know what happened.
If the problem was not solved let us know about the error line plz.
Good Luck!

Categories

Find more on Word games in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!