Incorrect argument data type or missing argument in call to function 'sqrt'.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (3)
VBBV
il 20 Giu 2023
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 Commenti
VBBV
il 20 Giu 2023
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
il 20 Giu 2023
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
il 20 Giu 2023
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 Commenti
RANGA BHARATH
il 20 Giu 2023
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 Commenti
Vedere anche
Categorie
Scopri di più su Uncertain Models in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!