How to use exp() and powers ^ in uncertain matrixes?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dylan Bartlett
am 29 Jun. 2023
Kommentiert: Steven Lord
am 29 Jun. 2023
I am trying to represent a thermistor using the Robust Control Toolbox.

I've created ureal objects to represent the thermistors base tolerance and beta and now want to create a matrix that represents the resistance.
ntcBase = ureal('ntcBase',2200,'Percentage',5)
ntcBeta = ureal('ntcBeta',3500,'Percentage',1)
ntcR = exp(ntcBeta)
I'm having issues getting exponentials and powers working in umats where the power is a ureal object and get the following error.
untitled
ntcBase =
Uncertain real parameter "ntcBase" with nominal value 2.2e+03 and variability [-5,5]%.
ntcBeta =
Uncertain real parameter "ntcBeta" with nominal value 3.5e+03 and variability [-1,1]%.
Check for incorrect argument data type or missing argument in call to function 'exp'.
Error in untitled (line 4)
ntcR = exp(ntcBeta)
Are these operators supported with these objects, or am I missing something else?
Thanks for the help
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 29 Jun. 2023
ntcBase = ureal('ntcBase',2200,'Percentage',5)
Let's see what operations are defined for this class.
methods(ntcBase)
The list of methods for this type of object does not include exp so it is not defined for this class. To double-check, let's see what would be called if you ran the command you tried:
which -all exp(ntcBase)
Compare with the following, which correctly identifies the exp function for double arrays:
which -all exp(1)
The power function (the .^ operator) is not listed in the methods list, but the mpower function (the ^ operator) is. Since ntcBase is a scalar, the two would perform equivalent operations.
y1 = ntcBase^2
y1.NominalValue
2200^2
y2 = ntcBase.^2
I'm not sure why the class doesn't define power. [Robust Control Toolbox is not my area of expertise.] This seems like a reasonable enhancement request to file with Technical Support. I could see exp being a little bit trickier to implement, though.
2 Kommentare
Steven Lord
am 29 Jun. 2023
From a little experimentation it looks like the mpower operator for ureal objects expects the base to be a ureal and the exponent to be an integer valued scalar number. The mpower function is asking questions (with the iosize utility function) about the first input that make sense for a ureal but not for a double value like exp(1).
ntcBase = ureal('ntcBase',2200,'Percentage',5);
ntcBase ^ 0.5
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Uncertain Models finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!