I have the following code which has 6 for loops to obtain a sum. I was wondering if the sum can be done without the use for loops, since they are very slow in matlab. (Something like vectorizing)
function ts=Tes(i,j,k,l,m,n,x)ts=beselj(i-j,x)*besselj(j-k,x)*besselj(k-l,x)*besselj(l-m,x)*besselj(l-n,x);end function ds=Ds(x) dds=0; for i=1:21 for j=1:21 for k=1:21 for l=1:21 for m=1:21 for n=1:21 dds=dds+Tes(i,j,k,l,m,n,x); end end end end end ds=dds; end
Thanks in advance!
Best Answer