Hello Friends, I am trying to execute a simple code but keep getting the following error message: Subscript indices must either be real positive integers or logicals. I get the error message for the code in italics. Kindly help. Thanks...
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
David Konneh
el 31 de Ag. de 2018
Comentada: Star Strider
el 3 de Sept. de 2018
SOC(1)=(SOCmn +((IBAT(1)*ebc*1)/(cbat))); if SOC(1)>SOCmx SOC(1)=SOCmx; end for y=1:8760 SOC(y)=(SOC(y-1)*(1-dh) + Pgen(y)-(Pload(y)/EFFINV))*ebc; if SOC(y)>SOCmx SOC(y)=SOCmx; end end
1 comentario
madhan ravi
el 31 de Ag. de 2018
Editada: madhan ravi
el 31 de Ag. de 2018
Upload your code with datas.
Respuesta aceptada
Star Strider
el 31 de Ag. de 2018
This is the problem:
for y=1:8760
_SOC(y)=(SOC(y-1)*(1-dh) + ...
In the first iteration through the loop, ‘y’ is 1, so (y-1) is 0.
Zero is not a positive integer. Positive integers are integers greater than 0.
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!