Arithmetic operators. MATLAB/Octave Python Description a=1; b=2; a=1; b=1Assignment; defining a number. a + b a + boradd(a,b)Addition. a - b a - borsubtract(a,b)Subtraction. a * b a * bormultiply(a,b)Multiplication. a / b a / bordivide(a,b)Division. a .^ b a ** b power(a,b) pow(a,b) Power, $a^b$. Jul 30, 2013 · Doing a comparison for a 10,000 x 10,000 matrix, the element-wise multiplication took 13.87 seconds and the for loop took 3,782 seconds. Now, you don’t have to remove every for loop, just the ones that are doing the majority of the work. Start with the inner loop and work your way out. Matlab will automatically figure out how many entries you need and their values. For example, to create a vector whose entries are 0, 2 , 4, 6, and 8, you can type in the following line: >> 0:2:8 ans = 0 2 4 6 8. Matlab also keeps track of the last result. In the previous example, a variable ans is created. Nov 06, 2013 · It calculates the wanted sum over the rows also if A is a coulmn matrix. Then the output must equal the input, but with sum(A')' a scalar is replied, because Matlab decides smartly to sum over the column.