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

조회 수: 3 (최근 30일)
aditya vittal
aditya vittal 2014년 9월 9일
답변: Salaheddin Hosseinzadeh 2014년 9월 9일
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
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
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!

카테고리

Help CenterFile Exchange에서 Word games에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by