Subscript indices must either be real positive integers or logicals???
이전 댓글 표시
I am relatively new to matlab. So I am trying out some logic in the following lines which gives me the error which I think is because one variable is over writing the other though I am not sure how.
CODE:
function f = initial(R,init,num,color)
x = zeros(num,1);
x(1)=init;
t = 0:20:100;
for i = 1:num
x(i+1)= R * x(t) * (1 - x(t));
end
plot(x,t)
end
ERROR:
Subscript indices must either be real positive integers or logicals.
Error in initial (line 7) x(i+1)= R * x(t) * (1 - x(t));
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 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!