Vectorization MATLAB sum equation snippet -


i new matlab, , understand how can vectorize below snippet, or how can efficiently:

sum=0; = 1:50    sum=sum+i; end 

you can use sum native function:

total = sum(1:50); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -