t = 0:dt:T;x = xl:dx:xr;u = zeros(xn+1,tn+1);for j = 1:tn; tm = j*dt; if j == 1; for i = 2:xn; T1 = ((gamma(2-bta))/((gamma(j-1+2))*(gamma(1-bta-j+1))))*(u(i+1,1)-2*u(i,1)+u(i-1,1)); T2 = (2.5*(tm.^1.5)+(gamma(3.5)/gamma(3.5-bta))*(tm.^(2.5-bta)))*sin(x(i)); u(i,j+1)=u(i,j)+mu.*T1+dt.*(T2); end endend
MATLAB: How can i vectorize this for loop? please help.
vectorization
Best Answer