But you defined U as a double precision array! See the difference.
Note that zeros(5) creates a 5x5 array. If you wanted a vector of length 5, then use zeros(5,1) or zeros(1,5).
But now, had you done it like this:
So U is a symbolic array of zeros. Now when you assign elements into U, there is no problem.