I'd like to vectorize this code:
for i = 1:N-2
for j = 1:N
Jacobian(i,j) = D2Mat(i+1,j)+(2/XCheb(i+1))*...
where D2Mat is (NxN), XCheb is (N,1), D1Mat is (NxN), D0Mat is (NxN), Y is (N,1) and xi, n are real values.