Incorrect argument data type or missing argument in call to function 'sqrt'.
2 ビュー (過去 30 日間)
古いコメントを表示
clc
Lc0 = ureal('Lc0',4.2e-3,'percent',10);
Lg0 = ureal('Lgo',2.5e-3,'percent',30);
Cf0 = ureal('Cf0',8e-6,'percent',10);
wr=sqrt((Lc0+Lg0)/(Lc0*Lg0*Cf0));
gives following error
Check for incorrect argument data type or missing argument in call to function 'sqrt'.
0 件のコメント
回答 (3 件)
VBBV
2023 年 6 月 20 日
clc
Lc0 = ureal('Lc0',4.2e-3,'percent',10)
Lg0 = ureal('Lgo',2.5e-3,'percent',30)
Cf0 = ureal('Cf0',8e-6,'percent',10)
wr=sqrt((Lc0.NominalValue+Lg0.NominalValue)./(Lc0.NominalValue*Lg0.NominalValue*Cf0.NominalValue))
2 件のコメント
VBBV
2023 年 6 月 20 日
From the outputs of ureal function, it is evident that you need to specify a Nominal value to evaluate the expression within sqrt function. From the doc page of ureal function, the nominal value can be accessed similar to a struct variable within the range inputs
VBBV
2023 年 6 月 20 日
clc
Lc0 = ureal('Lc0',4.2e-3,'percent',10)
get(Lc0)
Lg0 = ureal('Lgo',2.5e-3,'percent',30)
get(Lg0)
Cf0 = ureal('Cf0',8e-6,'percent',10)
get(Cf0)
Vishnu Vardhan
2023 年 6 月 20 日
Hi Amulya,
In this case "sqrt" function is not accepting ureal objects. So instead, try it by changing into double precession scalar.
Here is the sample code:
clc;
Lc0 = ureal('Lc0',4.2e-3,'percent',10);
Lg0 = ureal('Lgo',2.5e-3,'percent',30);
Cf0 = ureal('Cf0',8e-6,'percent',10);
x = (double(Lc0) + double(Lg0)) / (double(Lc0) * double(Lg0) * double(Cf0));
wr = sqrt(x);
Also, note that this error can occur even if the input is negative.
0 件のコメント
RANGA BHARATH
2023 年 6 月 20 日
Question: Incorrect argument data type or missing argument in call to function 'sqrt'.
Solution:
If you go inside the ureal variables you have created, there are some properties associated with the uncertian real parameters.
And there is a property called NominalValue. It has a 'numerical value' and data type associated with it is 'double'.
So, it is evident that instead of passing the whole uncertain real parameter into the sqrt function, you can pass only the NominalValue or you can also typecast the parameter into double.
Code:
clc
Lc0 = ureal('Lc0',4.2e-3,'percent',10)
Lg0 = ureal('Lgo',2.5e-3,'percent',30)
Cf0 = ureal('Cf0',8e-6,'percent',10)
%% Typecasting
sqrt((double(Lc0) + double(Lg0)) / (double(Lc0) * double(Lg0) * double(Cf0)))
%% Specifying the NominalValue
wr=sqrt((Lc0.NominalValue+Lg0.NominalValue)/(Lc0.NominalValue*Lg0.NominalValue*Cf0.NominalValue))
Links to Documentation:
- Here is the link to the documentation of ureal to know accessing a particular property of the uncertain real parameter: Uncertain real parameter - MATLAB - MathWorks India
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Uncertain Models についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!