You defined f as scalar
And in the following line, try to acess as a array.
u(j,n) = (1+dt*Q)*f(j) + (mu/Pr)*(f(j+1)-2*f(j)+f(j-1));
When you iterate the for loop till J (10) iterartion, how can it get the value of f, as f=0, defined as earlier.
Please note , suppose f=[5 6 4 5 90 200], the
f(1) means 5
f(2) menas 6 ...so on
Alos please ensure that the loop iterartion does not exceded the vector length, those are tring to ecess with the loop.