Utilizing sqrt and square, "Check for incorrect argument data type or missing argument in call to function 'sqrt'"
조회 수: 16 (최근 30일)
이전 댓글 표시
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 "^"?
댓글 수: 2
Stephen23
2021년 9월 30일
The SQRT function is only defined for floating point types SINGLE and DOUBLE, not for integer types:
답변 (1개)
Rik
2021년 9월 30일
편집: Rik
2021년 9월 30일
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.
help hypot
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!