Indexing input must be numeric, logical or ':'.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
David Young
il 9 Set 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.
Risposte (1)
Salaheddin Hosseinzadeh
il 9 Set 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!
0 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!