Respuesta :

Answer:

You don't really need the for loop to calculate B square.

The element-wise multiplication operator can help you get the square of each element of B.

B = [1, 2 3; 4, 5,6; 7,8,9];

B = B.^2;

Hope this helps!