MATLAB: How can i do decimal increment in for loop starting from 0

for loopstarts from zero

for t=0:0.5:2;
p2(t)=3*t*(1-t)*(1-t);
end
Error message : Subscript indices must either be real positive integers or logicals.

Best Answer

t=0:0.5:2;
p2 = 3*t.*(1-t).^2