Subscript indices must either be real positive integers or logicals???
Show older comments
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));
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!