hi, help please when I put this formula GEH2= sqrt(2*int64((flujo_sim2-FlujoReal2)^2)/int64(flujo_sim2+FlujoReal2)) in matlab, this returns me the following error: Check for missing argument or incorrect argument data type in call to function 'sqrt'.
why does this error give me?

답변 (4개)

Steven Lord
Steven Lord 2020년 12월 11일

1 개 추천

The sqrt function is not defined for variables of the int64 data type. The square root of an integer value is not necessarily itself an integer value. If it were defined, what exactly would you expect x to be in the following code?
five = int64(5)
five = int64 5
x = sqrt(five)
Check for missing argument or incorrect argument data type in call to function 'sqrt'.

댓글 수: 8

EDISON TOAPANTA IZA
EDISON TOAPANTA IZA 2020년 12월 11일
hi Steven,
Ok, I have cut the formula into two parts:
1.-FGEH= 2*int64((flujo_sim2-FlujoReal2)^2)/int64(flujo_sim2+FlujoReal2);
2.- GEH2= sqrt(FGEH)
and gives me the following result:
>> FGEH
FGEH =
int64
69825
>> GEH2= sqrt(FGEH)
Check for missing argument or incorrect argument data type in call to function 'sqrt'.
>> GEH2= sqrt(69825) %when I put numbers it works fine
GEH2 =
264.2442 (This is ok)
Théophane Dimier
Théophane Dimier 2020년 12월 11일
Why are you using int64? If it is to round the value, you should use round, floor or ceil instead of int64.
EDISON TOAPANTA IZA
EDISON TOAPANTA IZA 2020년 12월 11일
what happens is that without int 64 it gives me different values than the ones I want to show but when I put Int 64 it matches the values that I have in other software
If sqrt were defined for int64 variables, your GEH2 would be:
GEH2 = int64(sqrt(69825))
GEH2 = int64 264
Is that acceptable to you?
GEH2.^2
ans = int64 69696
EDISON TOAPANTA IZA
EDISON TOAPANTA IZA 2020년 12월 11일
ok, I put the following
FGEH= 2*(flujo_sim2-FlujoReal2)^2/(flujo_sim2+FlujoReal2);
GEH2= int64(sqrt(FGEH));
and the message was the following:
Check for missing argument or incorrect argument data type in call to function 'sqrt'.
Error in GEH_Y_RMSE (line 139)
GEH2= int64(sqrt(FGEH));
Can you show the output of the following command executed immediately before the line where you define FGEH?
whos flujo_sim2 FlujoReal2
I suspect one or both of those variables are int64. If so the results of all that arithmetic is again an int64 array and sqrt is not defined for int64 arrays.
EDISON TOAPANTA IZA
EDISON TOAPANTA IZA 2020년 12월 14일
Hi, of course.
flujo_sim2=datapoint2.get('AttValue', 'Vehs(Current, Total, All)'); %give me value the software external (simulation)
FlujoReal2 =(flujo_med233 + flujo_med234 + flujo_med235); %gives me the total field value (real life) obtained from an excel table.
The lines of code you posted doesn't tell me the class of the variables, which is the important information.
But I repeat my previous question. If you have an int64 number that is not a perfect square, would you be okay with getting an answer that when squared does not give you back the original number?
sqrtDouble = sqrt(5)
sqrtDouble = 2.2361
sqrtInt = int64(sqrt(5))
sqrtInt = int64 2
sqrtDouble.^2 - 5 % close to 0
ans = 8.8818e-16
sqrtInt.^2 - 5 % not really close to 0
ans = int64 -1

댓글을 달려면 로그인하십시오.

Théophane Dimier
Théophane Dimier 2020년 12월 11일

0 개 추천

Hi, sqrt does not accept int64 as input. If you want to round the quantity first, use round, ceil or floor functions instead
David Hill
David Hill 2020년 12월 11일

0 개 추천

Cannot take sqrt of int64 data type. Take sqrt of double then round and convert to int64.
ramadurai ramapragasam
ramadurai ramapragasam 2021년 7월 29일

0 개 추천

preprocds = transform(letterds,@scale)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

태그

질문:

2020년 12월 11일

답변:

2021년 7월 29일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by