MATLAB: For Loops with Increments Less Than One

for looploops

I have to solve this equation with a for loop from 1 to 10 in increments of .01, but what I'm doing isn't working and I don't know why. It works just the way I want to when I take a way the constraint for the increment. Here's what I'm doing:
for t=1:.01:10
x(t)=a*cos((sqrt(g/l))*t)
end

Best Answer

t=1:.01:10;
for i=1:length(t)
x(i)=a*cos((sqrt(g/l))*t(i))
end