MATLAB: What is the difference between using a “.” in mathematical operations

mathematicsoperators

For example, x.^2 and x^2.
Thank you!

Best Answer

if x is a vector/ matrix , you have to use x.^2. It is element by element power. If x is a scalar, x^2 is sufficient. Read about element by element operations in matlab.