How to use exp() and powers ^ in uncertain matrixes?
4 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Steven Lord
2023 年 6 月 29 日
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 件のコメント
Steven Lord
2023 年 6 月 29 日
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
その他の回答 (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!