In the line
DDy(i+1) = 12*t.*y(i) + (18*t.^2 - 6).*(y(i).^2).*Dy(i);
t
contains i+1
elements, so the right-hand side is a vector of length i+1
. However, the left-hand side refers to a single value, namely one entry of DDy
. So you are trying to assign a vector to a single entry of DDy
. Hence the error.
Maybe you mean t(i+1)
instead of t
on that line?