Indexing input must be numeric, logical or ':'.
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
David Young
2014 年 9 月 9 日
Please format the code in your question. Put two spaces at the start of each line, or select it and use the "{} Code" button.
回答 (1 件)
Salaheddin Hosseinzadeh
2014 年 9 月 9 日
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!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!