Utilizing sqrt and square, "Check for incorrect argument data type or missing argument in call to function 'sqrt'"
28 views (last 30 days)
I am currently trying to create an expression
where Ix, and Iy are 100x100 uint8 matrixes
X = sqrt((Ix^2)+(Iy^2))
However I get "Check for incorrect argument data type or missing argument in call to function 'sqrt'"
I am wondering what is wrong here, additionally should I be using element power ".^" instead of "^"?
Rik on 30 Sep 2021
Edited: Rik on 30 Sep 2021
As Stephen mentioned, the sqrt function expects either single or double. So you will have to convert it to either of those data types.
Additionally, you probably want to use .^ as that would make the square element-wise. If you don't, it makes more sense you want sqrtm instead.
X = sqrt(double( (Ix.^2)+(Iy.^2) ));
You could also consider hypot to do this computation.