I have 2 matrices containing 2D data on spatial components of Vx and Vy motion vector components.
How to I easily combine the 2 matrices to obtain the magnitude matrix (sqrt(Vx^2+Vy^2))?
You can also use hypot
:
result = hypot(Vx, Vy);
According to the documentation,
C = hypot(A,B)
returnssqrt(abs(A).^2+abs(B).^2)
carefully computed to avoid underflow and overflow.