MATLAB: What kind of formula is that

formulascalarstepstepcountingvectorvectors

I've been trying to count steps using Matlab and I found this link: https://www.mathworks.com/help/supportpkg/mobilesensor/examples/counting-steps-by-capturing-acceleration-data-from-your-android-device.html?searchHighlight=step%2520counting&s_tid=doc_srchtitle The equation that they used here to convert the vector values to scalar (this one:
mag = sqrt(sum(x.^2 + y.^2 + z.^2, 2))
looks kinda weird to me. I thought it's the scalar product. Can anyone tell me which specific (basic) formula they used? Thank you!

Best Answer

It is just the vector length, aka magnitude:
Note that the code uses element-wise power. Each of x, y, and z are column vectors, and so each row represents a different data vector. The sum is not required.